riotj/osonsms-gateway

A simple library for sending SMS via OsonSMS API.

1.0.0 2023-09-11 06:28 UTC

This package is auto-updated.

Last update: 2024-09-11 08:52:27 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

Installation

You can install the package via composer:

composer require riotj/osonsms-gateway

Usage

Run following command to publish a migration file:

php artisan vendor:publish --provider="OsonSMS\SMSGateway\SMSGatewayServiceProvider" --tag="migrations"

Run php artisan migrate to create a necessary package table.

To create a config file in order to specify OsonSMS credentials run following command:

php artisan vendor:publish --provider="OsonSMS\SMSGateway\SMSGatewayServiceProvider" --tag="config"

Open config/smsgateway.php config file and specify following parameters:

  • login - Login from OsonSMS
  • hash - Hash string
  • sender_name - SMS Sender Name assigned to you

You can send SMS in your Laravel code using folowing code:

$txn_id = uniqid();
$result = SMSGateway::Send('xxxxxxxxx', 'This is my test message from Laravel!', $txn_id);
if ($result)
    echo "SMS has been sent succesfully";
else
    echo "When sending SMS an error occurred";

You can find the logs of your SMS in the table called osonsms_log.

To check your balance use following code SMSGateway::getBalance() which returns a decimal number, indicating your balance in Somoni.

If you have any further questions or recommendations, feel free to send us an email at info@rio.tj.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@rio.tj instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.