| Package Data | |
|---|---|
| Maintainer Username: | kevupton | 
| Maintainer Contact: | uptonkg@gmail.com (Kevin Upton) | 
| Package Create Date: | 2017-09-20 | 
| Package Last Update: | 2018-05-06 | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-27 03:08:55 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 1,067 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 1 | 
| Total Watchers: | 1 | 
| Total Forks: | 1 | 
| Total Open Issues: | 0 | 
Implementation of Laravel / Lumen Twilio
composer require kevupton/twilavel
<?php
// add directly from the app 
$app->register(\Kevupton\Twilavel\Providers\TwilavelServiceProvider::class);
OR
All service providers are registered in the config/app.php configuration file.
<?php
'providers' => [
    // Other Service Providers
    \Kevupton\Twilavel\Providers\TwilavelServiceProvider::class,
],
.env configuration
TWILIO_LOG_OVERRIDE=false
TWILIO_TOKEN=your_token
TWILIO_SID=your_sid
TWILIO_FROM=SwagApp
Execute php artisan vendor:publish for the complete config file.
Config: twilio.php
<?php
return array(
    // set to true to prevent the
    'log_override' => env('TWILIO_LOG_OVERRIDE', false),
    // Your Account SID and Auth Token from twilio.com/console
    'sid' => env('TWILIO_SID'),
    'token' => env('TWILIO_TOKEN'),
    // the default from which messages will be sent from
    'from' => env('TWILIO_FROM', 'Twilavel'),
);
Using the Facade
<?php 
\Twilio::message(new \Kevupton\Twilavel\Messages\BasicMessage('+61 123 456 789', 'Custom Body', 'From'));
Using the helper functions
<?php 
send_basic_message('+61 123 456 789', 'Custom Body', 'From');
Custom Message Example:
<?php
namespace App\Twilio\Messages;
use \Kevupton\Twilavel\Messages\Message;
use App\Models\User;
class VerifyPhone extends Message {
    const FROM = '+61123456789';
    /** @var string custom verification code */
    private $code;
    public function __construct(User $user, $mobile = null)
    {
        // use mobile other use user mobile
        $number = $mobile?: $user->mobile;
        parent::__construct($number, self::FROM);
        
        // get a random code
        $this->code = $user->generateMobileVerificationCode($number);
    }
    public function getBody()
    {
        return 'Your verification code: ' . $this->code;
    }
}
Using Custom Message:
<?php
send_message(new VerifyPhone($user, '+61123456789'));
You can choose to override sending API requests for development environment and just view them in the Log.
Simply just set TWILIO_LOG_OVERRIDE=true in your .env.
Feel free to make a pull request at any time. Any help is appreciated (Y)