{"id":15651860,"url":"https://github.com/lakshmaji/twilio","last_synced_at":"2025-09-12T02:32:13.423Z","repository":{"id":57010826,"uuid":"51926030","full_name":"lakshmaji/twilio","owner":"lakshmaji","description":"This package enables to send message or OTP to any mobile.This package uses external Twilio api.","archived":false,"fork":false,"pushed_at":"2023-08-12T08:05:36.000Z","size":226,"stargazers_count":31,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T16:18:56.885Z","etag":null,"topics":["authtoken","composer","laravel","php","sms","twilio"],"latest_commit_sha":null,"homepage":"http://lakshmaji.github.io/twilio/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lakshmaji.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-17T13:52:23.000Z","updated_at":"2024-01-25T11:32:21.000Z","dependencies_parsed_at":"2024-10-03T12:40:31.931Z","dependency_job_id":"f96ec82e-3486-4afe-a21c-6f41d2636ff4","html_url":"https://github.com/lakshmaji/twilio","commit_stats":{"total_commits":38,"total_committers":7,"mean_commits":5.428571428571429,"dds":"0.39473684210526316","last_synced_commit":"830e026951c711dd786393f26e362c35cbaf05ae"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lakshmaji%2Ftwilio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lakshmaji%2Ftwilio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lakshmaji%2Ftwilio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lakshmaji%2Ftwilio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lakshmaji","download_url":"https://codeload.github.com/lakshmaji/twilio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249105475,"owners_count":21213537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authtoken","composer","laravel","php","sms","twilio"],"created_at":"2024-10-03T12:40:25.216Z","updated_at":"2025-04-15T16:19:04.224Z","avatar_url":"https://github.com/lakshmaji.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel - Twilio\n[Wiki on web](http://lakshmaji.github.io/plivo/)\n\n[![Latest Stable Version](https://poser.pugx.org/lakshmajim/twilio/v/stable)](https://packagist.org/packages/lakshmajim/twilio)\n[![Total Downloads](https://poser.pugx.org/lakshmajim/twilio/downloads)](https://packagist.org/packages/lakshmajim/twilio)\n[![Latest Unstable Version](https://poser.pugx.org/lakshmajim/twilio/v/unstable)](https://packagist.org/packages/lakshmajim/twilio)\n[![License](https://poser.pugx.org/lakshmajim/twilio/license)](https://packagist.org/packages/lakshmajim/twilio)\n[![Monthly Downloads](https://poser.pugx.org/lakshmajim/twilio/d/monthly)](https://packagist.org/packages/lakshmajim/twilio)\n[![Daily Downloads](https://poser.pugx.org/lakshmajim/twilio/d/daily)](https://packagist.org/packages/lakshmajim/twilio)\n[![composer.lock](https://poser.pugx.org/lakshmajim/twilio/composerlock)](https://packagist.org/packages/lakshmajim/twilio)\n\n## INDEX\n\n|Index|Description|\n|---|:---|\n|[What it is](https://github.com/lakshmaji/twilio/blob/master/README.md#what-it-is)|- Introduction|\n|[Installation](https://github.com/lakshmaji/twilio/blob/master/README.md#installation) |- Installing Twilio package |\n|[Laravel Integration](https://github.com/lakshmaji/twilio/blob/master/README.md#laravel-integration) |- Integrating this package with Laravel application|\n|[Docs](https://github.com/lakshmaji/twilio/blob/master/README.md#method-available-parameters-and-responses)|- Description of methods available and parameters etc  [Method](https://github.com/lakshmaji/twilio/blob/master/README.md#method) [Responses](https://github.com/lakshmaji/twilio/blob/master/README.md#responses)|\n|[Miscellaneous](https://github.com/lakshmaji/twilio/blob/master/README.md#miscellaneous) |- Miscellaneous content regarding method calls\n  [Invalid method calls](https://github.com/lakshmaji/twilio/blob/master/README.md#invalid-method-calls)|- Invalid arguments (Not supported)|\n|[Sending SMS](https://github.com/lakshmaji/twilio/blob/master/README.md#sending-sms) |- A simple Examp to illustarte the using this package|\n|[Example with Laravel](https://github.com/lakshmaji/twilio/blob/master/README.md#example-code-for-laravel-along-with-sample-env-file)|- Sample code in Laravel|\n|[Exception Handling](https://github.com/lakshmaji/twilio/blob/master/README.md#handling-exceptions) |- An Exception Handling mechanism to catch errors|\n|[Twilio](https://github.com/lakshmaji/twilio/blob/master/README.md#twilio-trail-account-usage) |- How to Get registered on Twilio to use free trail account|\n|[License](https://github.com/lakshmaji/twilio/blob/master/README.md#licence) |- License|\n\n\n\n##WHAT IT IS?\n\n\n\n- This package is used to send sms to any mobile number.\n- This uses [Twilio](https://www.twilio.com/) API.\n- It requires *AccountSID* and *AuthToken*, they can be generated by registrting @at [Twilio](https://www.twilio.com/try-twilio)\n  - after registration click on Account ,there you will be able to see authsid and authtoken. \n  - You have assigned a sender mobile number which can be found at [Twilio](https://www.twilio.com/user/account/phone-numbers/incoming),which is used to send Text Messages or MMS and ShortCodes etc.\n\n\n\n---\n\n\n\n##INSTALLATION\n\n\n - Download package form  https://github.com/lakshmaji/twilio . \n - OR YOU CAN RUN FOLLOWING COMMAND FROM TERMINAL\n - With composer you can run this line **composer require lakshmaji/twilio**\n\nRun this command from the Terminal:\n\n```bash\n    composer require lakshmaji/twilio\n    composer dumpautoload\n    composer update\n```\n\n***\n\n##LARAVEL INTEGRATION\n\nyou need to add the service provider. Open `app/config/app.php`, and add a new item to the providers array.\n```php\n  Lakshmaji\\Twilio\\TwilioServiceProvider::class,\n```\nThen, add a Facade for more convenient usage. In `app/config/app.php` add the following line to the `aliases` array:\n```php\n  'Twilio'    =\u003e Lakshmaji\\Twilio\\Facade\\Twilio::class,\n```\nAgain do composer update\n\n***\n\n\n## METHOD, AVAILABLE PARAMETERS AND RESPONSES\n\n#####Method\n```php\nmessage(array, string, boolean, boolean, boolean)\n```\n\n```php\n\n    $message_array = array(\n        'sender_id'     =\u003e 'TWILIO_AUTH_SID',\n        'sender_secret' =\u003e 'TWILIO_AUTH_SECRET',\n        'reciver_mobile' =\u003e 'MOBILE_NUMBER',\n        'media_url' =\u003e 'MEDIA_URL',\n        'otp'     =\u003e'OTP',\n        'sender' =\u003e 'TWILIO_SOURCE_NUMBER'\n    );\n  \n```\n\n##### The message_array parameters \n\n| PARAMETER           | DESCRIPTION                             |\n|:-------------- |:----------------------------------------| \n|sender_id   | This is the key defined in \".env\" file for auth_sid                | \n|sender_secret| This is the key defined in \".env\" file for auth_secret                  |\n|  sender         | This is the key defined in .env file for sender mobile number  |\n|reciver_mobile| This is the receivers mobile number|\n|media_url|This is the \"uri\" for mutimedia|\n|otp|This key values associates with the otp|\n     \n \n        \n##### Responses\n\n| CODE           | DESCRIPTION                             |\n|:-------------- |:----------------------------------------| \n|16000   | Error due to all flags are set to false or no flag was set| \n|16001|Error due to all flags were set to true |\n|16002|No sms type was set witin the avialbel list of flag parameters|\n|16003|Un handled error|\n\n\n\n***\n\n\n##MISCELLANEOUS\n\n#####To send SMS\n```php\n  Twilio::message($message_array,$op=\"only msg\", true,  false, false ); // sms\n```\n\n#####To send MMS\n```php\n  Twilio::message($message_array,$op=\"only MMS\", false, false, true  ); // media\n```\n#####To send OTP\n```php\n  Twilio::message($message_array,$op=\"only verfication code\", false, true,  false ); // otp\n```\n#####To send both SMS and MMS\n```php\n  Twilio::message($message_array,$op=\"This is combaination both SMS and MMS\", true,  false, true  ); // sms , media \n```\n\n\n\n#####INVALID METHOD CALLS\n\n```php\nTwilio::message($message_array,$op=\"All set to true sms,mms,otp\", true,  true,  true  ); // sms , otp , media\nTwilio::message($message_array,$op=\"all set to false\", false, false, false );            // none defined\nTwilio::message($message_array,$op=\"all considered to be false\");                        // none defined\nTwilio::message($message_array); \n\n```\n\n\n***\n\n\n\n\n\n\n\n\n\n\n##SENDING SMS\n\n```php\n\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\nuse Twilio; \n\n\n/**\n * Twilio - Package usage Example\n *\n * @access  public\n * @since   1.2.0\n * @author  lakshmaji \n */\nclass TwilioTest extends Controller\n{\n  public function testMesssage()\n  {\n\n    // initialize message array \n    $message_array = array(\n        'sender_id'     =\u003e 'TWILIO_AUTH_ID',\n        'sender_secret' =\u003e 'TWILIO_AUTH_SECRET',\n        'reciver_mobile' =\u003e '999999999',\n        'media_url' =\u003e 'http://goo.gl/F9igRq',\n        'otp'     =\u003e'325565',\n        'sender' =\u003e 'TWILIO_SOURCE_NUMBER'\n    );\n\n\n    // This will send message only\n    $sms_response = Twilio::message($message_array,$op=\"only msg\", true,  false, false ); \n\n    return response()-\u003ejson($sms_response,200);\n  }\n\n}\n// end of class TwilioTest\n// end of file TwilioTest.php\n\n```\n\n\n      \n             \n\n\n##Example code for Laravel along with sample .env file\n\n**.env file**\n```erlang\n\nAPP_ENV=local\nAPP_DEBUG=true\nAPP_KEY=BPfhzoGJ7RJB8D3qoyP6KZ2MjX2MAzcN\n\nDB_HOST=127.0.0.1\nDB_DATABASE=homestead\nDB_USERNAME=homestead\nDB_PASSWORD=secret\n\nCACHE_DRIVER=file\nSESSION_DRIVER=file\nQUEUE_DRIVER=sync\n\nREDIS_HOST=127.0.0.1\nREDIS_PASSWORD=null\nREDIS_PORT=6379\n\nMAIL_DRIVER=smtp\nMAIL_HOST=mailtrap.io\nMAIL_PORT=2525\nMAIL_USERNAME=null\nMAIL_PASSWORD=null\nMAIL_ENCRYPTION=null\n\n\nTWILIO_SOURCE_MOBILE_NUMBER=+44778338721\nTWILIO_USER_ID=ACef0d5a519rwetbf821ea07c2fdbfd8204e\nTWILIO_USER_PASSWORD=a0fb23srfdsf4825cbb9501df25b906a74\n\n```\n\n\n\nThe code to use above \".env\" file is given below\n```php\n\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\nuse Twilio; \n\n\n/**\n * Twilio - Package usage Example\n *\n * @access  public\n * @since   1.2.0\n * @author  lakshmaji \n */\nclass TwilioTest extends Controller\n{\n  public function testMesssage()\n  {\n\n    // initialize message array \n    $message_array = array(\n        'sender_id'     =\u003e 'TWILIO_USER_ID',\n        'sender_secret' =\u003e 'TWILIO_USER_PASSWORD',\n        'reciver_mobile' =\u003e '99999999999',\n        'media_url' =\u003e 'http://goo.gl/F9igRq',\n        'otp'     =\u003e'325456',\n        'sender' =\u003e 'TWILIO_SOURCE_MOBILE_NUMBER'\n    );\n\n    // This will send OTP only\n    $sms_response = Twilio::message($message_array,$op=\"otp only\", false, true,  false ); // otp\n\n    return response()-\u003ejson($sms_response,200);\n  }\n\n}\n// end of class TwilioTest\n// end of file TwilioTest.php\n\n\n```\n\n***\n\n## Handling Exceptions\n\n```php\n\u003c?php\n\nnamespace App\\Exceptions;\n\nuse Exception;\nuse Lakshmaji\\Twilio\\Exception\\TwilioException;\n\n\n/**\n * Twilio - A Simple Exception handler class to Catch\n * Exceptions thrown by TwilioException class \n *\n * @author   lakshmaji \n */\nclass Handler extends ExceptionHandler\n{\n \n    //....\n    //.................\n    //....\n    \n     /**\n     * Render an exception into an HTTP response.\n     *\n     * @param  \\Illuminate\\Http\\Request  $request\n     * @param  \\Exception  $e\n     * @return \\Illuminate\\Http\\Response\n     */\n    public function render($request, Exception $e)\n    {\n        if($e instanceof TwilioException)\n        {\n            return response()-\u003ejson(array('message'=\u003e$e-\u003egetMessage(),'status' =\u003e$e-\u003egetStatusCode()),500);\n        }\n        return parent::render($request, $e);\n    }\n}\n\n```\nIn laravel we can easily handle the errors by using Handler.php (You can use custom Exception Handlr too)\n\n\n\n\n***\n\n## TWILIO TRAIL ACCOUNT USAGE:\n\n - If You are trying to implement SMS functionality with Twilio the you need to verify the list of destination mobile numbers at [Twilio](https://www.twilio.com/user/account/phone-numbers/verified)\n![VERIFIED NUMBERS](https://raw.githubusercontent.com/lakshmaji/images/master/verified_numbers.png)\n - Before sending MESSAGE make sure that you have enabled **GEO-PERMISSIONS** at [Twilio](https://www.twilio.com/user/account/settings/international)\n![GEO PERMISSIONS](https://raw.githubusercontent.com/lakshmaji/images/master/geo_permissions.png)\n\n***\n\n##Licence\n\n[*MIT License (MIT)*](https://opensource.org/licenses/MIT)\n\n@ MUTYALA ANANTHA LAKSHMAJI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakshmaji%2Ftwilio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flakshmaji%2Ftwilio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakshmaji%2Ftwilio/lists"}