GeeH / twilio-laravel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 git@github.com:twilio-labs/sample-template-laravel.git
    cd sample-template-laravel
  2. Install PHP dependencies

    composer install
  3. Generate application key

    php artisan key:generate
  4. Set your environment variables

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables.

  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.

About

License:MIT License


Languages

Language:PHP 97.5%Language:HTML 2.5%