telstraSMS
, (*1)
telstraSMS is a PHP package for the Telstra SMS API., (*2)
The author is not affiliated with Telstra and Telstra is not involved in the development of this package in any way., (*3)
Install
Via Composer, (*4)
``` bash
$ composer require kubacode/telstrasms, (*5)
## Laravel Configuration
telstraSMS has optional support for Laravel and comes with a Service Provider and Facades for easy integration. The vendor/autoload.php is included by Laravel, so you don't have to require or autoload manually. Just see the instructions below.
After you have installed telstraSMS, open your Laravel config file config/app.php and add the following lines.
In the $providers array add the service providers for this package.
``` php
kubacode\telstraSMS\SMSServiceProvider::class,
Add the facade of this package to the $aliases array., (*6)
``` php
'SMS' => kubacode\telstraSMS\SMSFacade::class,, (*7)
Now the SMS Class will be auto-loaded by Laravel.
You also need to supply your API Key & API Secret in your .env environment file.
SMS_API_KEY=clientKey
SMS_API_SECRET=clientSecret, (*8)
## Usage
``` php
$clientKey = 'clientKey';
$clientSecret = 'clientSecret';
$to = '0400000000';
$body = 'SMS Message'
$message = new kubacode\telstraSMS\telstraSMS($clientKey, $clientSecret);
$message->send($to, $body);
Laravel Usage
``` php
// usage inside a laravel route
Route::get('/', function()
{
$message = SMS::send('0400000000', 'Test SMS');, (*9)
return $message->messageId;
});
```, (*10)
Credits
License
The MIT License (MIT). Please see License File for more information., (*11)