expertsystemsau / transmitsms-laravel-client
Laravel notification channel and integration for the TransmitSMS API
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/expertsystemsau/transmitsms-laravel-client
Requires
- php: ^8.2
- expertsystemsau/transmitsms-php-client: ^1.0
- illuminate/notifications: ^10.0||^11.0||^12.0
- illuminate/support: ^10.0||^11.0||^12.0
- saloonphp/laravel-plugin: ^3.0
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.0||^10.0
- phpunit/phpunit: ^11.0
README
Laravel notification channel and integration for the TransmitSMS API.
Installation
composer require expertsystemsau/transmitsms-laravel-client
Publish the configuration file:
php artisan vendor:publish --tag="transmitsms-config"
Configuration
Add your credentials to your .env file:
TRANSMITSMS_API_KEY=your-api-key TRANSMITSMS_API_SECRET=your-api-secret TRANSMITSMS_FROM=YourSenderID
Usage
Facade
use ExpertSystems\TransmitSms\Laravel\Facades\TransmitSms; // Send an SMS TransmitSms::sendSms('+61400000000', 'Hello from Laravel!'); // Get account balance $balance = TransmitSms::getBalance();
Notifications
Create a notification that uses the TransmitSMS channel:
use Illuminate\Notifications\Notification; use ExpertSystems\TransmitSms\Laravel\Notifications\TransmitSmsMessage; class OrderShipped extends Notification { public function via($notifiable): array { return ['transmitsms']; } public function toTransmitSms($notifiable): TransmitSmsMessage { return (new TransmitSmsMessage()) ->content('Your order has been shipped!') ->from('MyStore'); } }
Add the routeNotificationForTransmitsms method to your notifiable model:
class User extends Authenticatable { use Notifiable; public function routeNotificationForTransmitsms($notification): ?string { return $this->phone_number; } }
Then send notifications:
$user->notify(new OrderShipped());
License
The MIT License (MIT). Please see License File for more information.