Skip to content

It is a package which makes it possible to send messages (SMS) through the gateway of https://www.1s2u.com

Notifications You must be signed in to change notification settings

Danny-Villa/1s2u-sms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

1s2u-sms

It is a package which makes it possible to send messages (SMS) through the gateway of https://www.1s2u.com

Installation

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',

Usage

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.
Send an auto-detected type message.
$response = MessageApi::setMessage('Hello word')
                      ->setSenderId('SMS')
                      ->setMobileNumbers(['123456789', '234567891'])
                      ->appendNumber('123456678')
                      ->send();
Send a simple text message.
$response = MessageApi::setMessage('Hello word', MessageApi::SIMPLE_TEXT_MESSAGE)
                      ->setSenderId('FROM')
                      ->setMobileNumbers(['1234567890'])
                      ->send();
Send a unicode message.
$response = MessageApi::setMessage('Hello word', MessageApi::UNICODE_MESSAGE)
                      ->setSenderId('FROM')
                      ->setMobileNumbers(['1234567890'])
                      ->send();
Send a flash message.
$response = MessageApi::setMessage('Hello word')
                      ->setSenderId('FROM')
                      ->setMobileNumbers(['1234567890'])
                      ->shouldFlash(true)
                      ->send();
Checking credit.

\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

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

It is a package which makes it possible to send messages (SMS) through the gateway of https://www.1s2u.com

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages