/laravel-iranian-sms

Laravel v5.0+ sms handler for working with most iranian sms operators

Primary LanguagePHPMIT LicenseMIT

Laravel SMS Component

Laravel Package for dealing with Iranian SMS prodivers working with Laravel 5 & 6

Installation

1.Installing Via composer

composer require tartan/laravel-iranian-sms

2.Add this to your app service providers :

    Tartan\IranianSms\SmsServiceProvider::class,

3.Add this to your aliases :

    'IranianSms' => Tartan\IranianSms\Facades\IranianSms::class

4.Publish the config file

php artisan vendor:publish --provider="Tartan\IranianSms\SmsServiceProvider" --tag=config

Usage Example :

    //using the default adapter
    resolve('iraniansms')->make()->send('0912xxxxxxx','test2x');

    //using kavenegar adapter
    resolve('iraniansms')->make('kavenegar')->send('0912xxxxxxx','test2x');


    //using Facede
    use Iraniansms;
    Iraniansms::make()->send('0912xxxxxxx','test2x');

available adapters

  • log (no charge adapter for development purposes)
  • slack (no charge adapter for development and staging environment)
  • mehrafraz مهر افراز
  • kavenegar کاوه نگار
  • smsir اسمس آی آر
  • ghasedak قاصدک

Example config:

<?php

return [
	//Default SMS gateway
	'default' => env('IRANIANSMS_DEFAULT','mehrafraz'),
	'mehrafraz' => [
		'gateway' => env('IRANIANSMS_MEHRAFRAZ_GATEWAY','http://mehrafraz.com/webservice/Service.asmx?WSDL'),
		'username' => env('IRANIANSMS_MEHRAFRAZ_USERNAME','test'),
		'password' => env('IRANIANSMS_MEHRAFRAZ_PASSWORD','test'),
	],
	'kavenegar' => [
		'gateway' => env('IRANIANSMS_KAVENEGAR_GATEWAY','http://api.kavenegar.com/v1/%s/%s/%s.json/'),
		'api_key' => env('IRANIANSMS_KAVENEGAR_APIKEY','test'),
		'sender' => env('IRANIANSMS_KAVENEGAR_SENDER','test'),
	],
	'smsir' => [
            'gateway' => env('IRANIANSMS_SMSIR_GATEWAY', 'http://ip.sms.ir/SendMessage.ashx'),
            'user' => env('IRANIANSMS_SMSIR_USER', 'test'),
            'pass'  => env('IRANIANSMS_SMSIR_PASS', 'test'),
            'line_no'  => env('IRANIANSMS_SMSIR_LINENO', 'test'),
    ],
    'ghasedak'=> [
        'api_key' => env('IRANIANSMS_GHASEDAK_APIKEY', 'test'),
        'sender'  => env('IRANIANSMS_GHASEDAK_SENDER', 'test'),
    ],
];