It is a package which makes it possible to send messages (SMS) through the gateway of https://www.1s2u.com
Use the package manager composer to install 1s2u-sms.
composer require dannyvilla/1s2u-sms
The OneServiceToYouSMSServiceProdiver
is auto-discovered and registered by default, but if you want to register it yourself:
Add the ServiceProvider in config/app.php :
'providers' => [
/*
* Package Service Providers...
*/
Oxanfoxs\OneServiceToYouSMS\Provider\OneServiceToYouSMSServiceProdiver::class,
]
Add the Facade in config/app.php :
'aliases' => [
...
'MessageApi' => Oxanfoxs\OneServiceToYouSMS\Facades\MessageApi::class,
]
You should publish the package to get access to config file :
php artisan vendor:publish --provider="Oxanfoxs\OneServiceToYouSMS\Provider\OneServiceToYouSMSServiceProdiver"
This will create a new config file named config/1s2u.php. Then you can update credentials within the 1s2u configuration file.
...
'username' => 'your-username-here',
....
'password' => 'your-password-here',
1s2u api allows to send 2 types of message.
- Simple text message : this type contains only GSM 03.38 characters
- Unicode message : this type use UCS-2 charset.
$response = MessageApi::setMessage('Hello word')
->setSenderId('SMS')
->setMobileNumbers(['123456789', '234567891'])
->appendNumber('123456678')
->send();
$response = MessageApi::setMessage('Hello word', MessageApi::SIMPLE_TEXT_MESSAGE)
->setSenderId('FROM')
->setMobileNumbers(['1234567890'])
->send();
$response = MessageApi::setMessage('Hello word', MessageApi::UNICODE_MESSAGE)
->setSenderId('FROM')
->setMobileNumbers(['1234567890'])
->send();
$response = MessageApi::setMessage('Hello word')
->setSenderId('FROM')
->setMobileNumbers(['1234567890'])
->shouldFlash(true)
->send();
\Oxanfoxs\OneServiceToYouSMS\MessageApi::checkCredit() method allows to check credits balance.
$response = MessageApi::checkCredit()
To get more information about the response please check the official documentation here
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.