amiraghaee/rahyabsms

Rahyab Payam Gostaran SMS package for Laravel

1.0.0 2021-05-01 08:23 UTC

This package is auto-updated.

Last update: 2024-09-29 06:02:54 UTC


README

Rahyab Payam Gostaran SMS Package


This package provide simple helpers for sending sms from Rahyab Payam Gostran gateway.
You can download the api gateway document here.

This is not an official package but there is no other package for this sms gateway!

Table of Contents

Install

The easiest way to install is by using Composer:

composer require amiraghaee/rahyabsms

Usage

To use the package, you need an password, username and shortcode. To get that you should have a smsonline account. Register and get your authorization details.
Copy the following variables to your project .env file and fill the variables with your data.

RAHYAB_SMS_USERNAME="your-account-username"
RAHYAB_SMS_PASSWORD="your-account-password"
RAHYAB_SMS_SHORTCODE="your-shortcode"

Use rahyabsms on top of your controller or wherever you want:

use AmirAghaee\rahyabsms;

send simple sms

Then you can simply create an instance of rahyabsms and use send method to send a text message:

Rahyabsms::send('09xxxxxxxxx','Hello World!');

parameters

send sms to several users

You can send a text message to several numbers with this method:

$numbers = [
        '09xxxxxxxx1',
        '09xxxxxxxx2',
        '09xxxxxxxx3'
    ];
Rahyabsms::sendAll($numbers, 'Hello World!');

check credit

You can check balance of your account with this method:

Rahyabsms::getCredit();

check expire

You can check expire of your account with this method:

Rahyabsms::GetExpireDate();

Logging

This package can automatically log sent SMS to the database.
To enable this, you must copy the following variables into your project .env file.

RAHYAB_SMS_ENABLE_LOGS=true

Then run following command to create a table at the root of your project:

php artisan migrate

For accessing to the model use following namespace:
namespace AmirAghaee\rahyabsms\Models;

example:

SmsLog::get();

License

Freely distributable under the terms of the MIT license.