Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

TwilioDevEd/marketing-notifications-laravel

Repository files navigation

SMS Notifications with Twilio and Laravel

Build Status

Use Twilio to create sms notifications to keep your subscribers in the loop.

Read the full tutorial here!

Local Development

  1. You will need to configure Twilio to send requests to your application when SMS are received.

    You will need to provision at least one Twilio number with sms capabilities so the application's users can make property reservations. You can buy a number right here. Once you have a number you need to configure your number to work with your application. Open the number management page and open a number's configuration by clicking on it.

    Remember that the number where you change the SMS webhook must be the same one you set on the TWILIO_PHONE_NUMBER environment variable.

    Configure Voice

    To start using ngrok on our project you'll have execute to the following line in the command prompt.

    ngrok http 8000
    

    Keep in mind that our endpoint is:

    http://<your-ngrok-subdomain>.ngrok.io/subscribers/register
    
  2. Clone this repository and cd into it.

    git clone git@github.com:TwilioDevEd/marketing-notifications-laravel.git
    cd marketing-notifications-laravel
  3. Install the application's dependencies with Composer.

    composer install
  4. The application uses PostgreSQL as the persistence layer. If you don't have it already, you should install it. The easiest way is by using Postgres.app.

  5. Create a database.

    createdb marketing_notifications
  6. Copy the sample configuration file and edit it to match your configuration.

    cp .env.example .env

You'll need to set DB_DATABASE, DB_USERNAME, DB_PASSWORD, TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_PHONE_NUMBER in your .env file.

  1. Generate an APP_KEY.

    php artisan key:generate
  2. Run the migrations.

    php artisan migrate
  3. Run the application using Artisan.

    php artisan serve
  4. Check it out at http://localhost:8000

Run the tests

  1. Create a database.

    createdb marketing_notifications_test
  2. Run the database migrations for the test database.

    APP_ENV=testing php artisan migrate
  3. Run at the top-level directory.

    phpunit

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

About

Demo application showing how to implement SMS notifications (for a mobile marketing use case) in PHP | Laravel

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages