GithubHelp home page GithubHelp logo

sample-template-laravel's Introduction

Twilio

Twilio Sample App Template

Laravel CI

About

This is a GitHub template for creating other Twilio sample/template apps. It contains a variety of features that should ideally be included in every Twilio sample app. You can use GitHub's repository template functionality to create a copy of this.

Implementations in other languages:

.NET Java Python PHP Node
TBD TBD TBD TBD Done

How it works

This application is only a barebones PHP application using Laravel. Whenever, possible we should be using this. However, if you are using a framework like Symfony, Lumen or similar that comes with their own standardized application structure, you should try to merge these by using the same README structure and test coverage, configuration etc. as this project.

Features

  • PHP web server using Laravel
  • Basic web user interface using Blade for templating and Bootstrap for UI
  • Unit tests using PHPUnit
  • End to End UI testing using Dusk
  • Automated CI testing using GitHub Actions
  • Linting and formatting using PHP Coding Standards Fixer
  • Project specific environment variables using .env files.
  • One click deploy buttons for Heroku.

How to use it

  1. Create a copy using GitHub's repository template functionality
  2. Update the README.md, composer.json and app.json with the respective values.
  3. Build your app as necessary while making sure the tests pass.
  4. Publish your app to GitHub

Set up

Requirements

Twilio Account Settings

This application should give you a ready-made starting point for writing your own application. Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
Account Sid Your primary Twilio account identifier - find this in the Console.
Auth Token Used to authenticate - just like the above, you'll find this here.
Phone number A Twilio phone number in E.164 format - you can get one here

Local development

After the above requirements have been met:

  1. Clone this repository and cd into it

    git clone [email protected]:twilio-labs/sample-template-laravel.git
    cd sample-template-laravel
  2. Install PHP dependencies

    composer install
  3. Set your environment variables

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables.

  4. Generate application key

    php artisan key:generate
  5. Install Node dependencies

    npm install 
  6. Build the frontend assets

    npm run dev
  7. Run the application

    php artisan serve
  8. Navigate to http://localhost:8000

    That's it!

Unit and Integration Tests

You can run the Unit and Feature tests locally by typing:

php artisan test

End to End Tests

  1. To run the Browser tests you first need to install the latest version of ChromeDriver for your OS

    php artisan dusk:chrome-driver
  2. Copy the .env.dusk.testing to .env.dusk.local

    cp .env.dusk.testing .env.dusk.local
  3. Then you can run the tests by typing:

    php artisan dusk

    Note: You need to have the dev server running or use php artisan dusk:serve instead

Cloud deployment

Additionally to trying out this application locally, you can deploy it to a variety of host services. Here is a small selection of them.

Please be aware that some of these might charge you for the usage or might make the source code for this application visible to the public. When in doubt research the respective hosting service first.

Service
Heroku Deploy

Resources

Contributing

This template is open source and welcomes contributions. All contributions are subject to our Code of Conduct.

Visit the project on GitHub

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

sample-template-laravel's People

Contributors

maylonpedroso avatar lopenchi avatar jefflinwood avatar mmena1 avatar

Watchers

Jarod Reyes avatar James Cloos avatar Devin Rader avatar Charlie Weems avatar Brent avatar Sam Agnew avatar Kat King avatar Craig Dennis avatar Ricky avatar  avatar Stefani Castellanos avatar  avatar Toby Duckworth avatar  avatar  avatar

sample-template-laravel's Issues

CI badge is broken

The badge for the Github actions is broken. Can you fix the reference?

Swap steps in README

The following steps: "Generate application key" and "Set your environment variables" should be swapped because the .env file should exist before generating the application key. Otherwise, an error is thrown by Artisan.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.