nishtman / laravel-sms
This package help you to call api of sms providers in iran with laravel framework
dev-master
2019-09-05 06:27 UTC
Requires
- php: ^7.0 | ^7.1 | ^7.2
- ext-soap: *
- guzzlehttp/guzzle: *
This package is auto-updated.
Last update: 2024-05-05 16:56:39 UTC
README
This library helps developers to easily call the web services of sms providers in Iran using the Larval Framework.
Supported providers
Installation
Requirements:
php >= 7.0
laravel >= 5.0
Run the Composer update command
$ composer require nishtman/sms
- First, enter the settings for your short message provider in the
config/sms.php
file and enter the module name you want in thedefault
section.
Usage
Sending sms
public function send() { /* * Instance the sms object */ $sms = new \Nishtman\Sms\Sms(); $result = $sms->send('09123456789', 'text message'); /* * or you can use facades */ $result = Nishtman\Sms\Facades\Sms::send('09123456789', 'text message'); }
Selecting provider
public function send() { /* * Instance the sms object */ $sms = new \Nishtman\Sms\Sms(); $result = $sms->provider('HostIran')->send('09123456789', 'text message') /* * or you can use facades */ $result = Nishtman\Sms\Facades\Sms::provider('HostIran')->send('09123456789', 'text message'); }
Methods and api
/* * Set the provider */ provider(string $provider): \Nishtman\Sms\sms
/* * Set sms message */ send(string $to, string $text): array /* * Array * ( * [status] => 'integer status code' * [message] => 'string message' * [referenceId] => 'integer reference id to get the delivery report' * ) */
/* * Get the delivery status */ delivery(int $referenceId): array /* * Array * ( * [string] => 'string status text' * ) */
/* * Get the credits value */ getCredits(int $referenceId): int /* * Array * ( * [int] => 'your credit amount' * ) */