Download the PHP package thepublicgood/smsportal without Composer
On this page you can find all versions of the php package thepublicgood/smsportal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package smsportal
SMSPortal client for Laravel
This library provides a complete implementation of the SMSPortal Rest API for Laravel. The library provides a generic client you can use to send SMSs and a Laravel Notifications Channel which can be used to easily send SMSs to specific entities.
Installation through Composer:
Once installed, publish the config file with:
This will place a simple smsportal.php file in your config directory. However, if you don't want to publish the provided config file, you can also alter the provided services.php config file with:
Configure your SMSPortal API ID and Secret in either the services.php or smsportal.php config file.
Basic usage
The library provides a Laravel facade to easily send arbitrary messages to one or more mobile numbers:
You can also send the same message to multiple numbers by passing in an array:
Advanced usage
If you need more control over who received what, the library has registered the SMSPortalClient interface into the Laravel container. You can create Message objects and pass them to the sendBulk method:
You can also use the send message to send a single message:
SMSPortal groups
If you've set up groups on contacts through SMSPortal, you can send a single message to the groups your choice by using the sendGroup method:
Laravel Notifications
If you want to use SMSPortal through Laravel Notifications, create a new Notification class and add smsportal to the array returned by the via method:
Then define a toSMSPortal method on the notification and return a message string:
On the notifiable class (your User class, for example) define a routeNotificationForSMSPortal method that returns the correct mobile number to send to:
Sending options
The library also provides a way to pass SMSPortal sending options. You can create a new instance of SendOptions and pass in any option you need. Pass this as the last parameter of the send, sendBulk or sendGroup methods: