Download the PHP package hooman-mirghasemi/laravel-iran-sms without Composer
On this page you can find all versions of the php package hooman-mirghasemi/laravel-iran-sms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-iran-sms
Laravel Iran Sms
This is a Laravel Package for Sms Senders Integration. This package supports Laravel 8+
, all tests passed for laravel 8, 9, 10 and 11!
Benefits of this package:
- Multiple drivers
- Support create custom drivers
- Have Fake build in driver, it can send success or failure sms/voice call message. (Can use in development and testing modes)
- Store sms reports in database
- Have a tools in only development mode in http://localhost/sms/get-sms-list (Your frontend developer can use it for access latest sms send with fake driver for example needs to otp codes, when he/she is developing some parts like forgot password)
- English documents
- داکیومنت فارسی
List of contents
- Laravel Iran Sms
- List of contents
- List of available drivers
- Install
- .env file
- How to use
- Working with Facades
- Working with Channels (use laravel notification classes)
- Create custom drivers:
- Events
- Contributing
- Credits
- License
List of available drivers
- fake sms sender :heavy_check_mark: (Both: Voice call/Sms)
- Avanak :heavy_check_mark: (Voice call driver)
- Kavenegar :heavy_check_mark: (Sms)
- Magfa :heavy_check_mark: (Sms)
- Sms Online :heavy_check_mark: (Sms)
Note: for using each of them check config file and use the needed env in your env file like username/password or api key depend on witch driver you use.
Note: to use magfa/sms online/avanak you should install php ext-soap.
.env file for each driver:
fake sms sender
// Use in your local .env file
SMS_DRIVER=fake
// It's optional if you want you can set a number
FAKE_SENDER_NUMBER=101010
Kavenegar
// Use in your production .env file if you want to use Kavenegar as default sms driver
SMS_DRIVER=kavenegar
// Your kavenegar account api key
KAVENEGAR_API_KEY=fsdf452fd
Magfa
// Use in your production .env file if you want to use Magfa as default sms driver
SMS_DRIVER=magfa
SMS_MAGFA_USERNAME=your magfa user name
SMS_MAGFA_PASSWORD=your magfa password
SMS_MAGFA_DOMAIN=your magfa domain
SMS_MAGFA_SENDER_NUMBER=your number in magfa you want to send sms with it
Sms Online
// Use in your production .env file if you want to use Sms Online as default sms driver
SMS_DRIVER=smsonline
SMS_ONLINE_USERNAME=your smsonline user name
SMS_ONLINE_PASSWORD=your smsonline password
SMS_ONLINE_SENDER_NUMBER=your number in smsonline you want to send sms with it
Avanak (voice caller)
// Use in your production .env file if you want to use Sms Online as default sms driver
VOICE_CALL_DRIVER=avanak
VOICE_AVANAK_USERNAME=your avanak user name
VOICE_AVANAK_PASSWORD=your avanak password
you can create your own custom drivers if it does not exist in the list, read the
Create custom drivers
section.
Install
Via Composer
Publish Vendor Files
It is optional and only if you need you can publish vendor files by these commands:
-
publish configuration files:
-
publish views for customization:
- publish migration:
.env file
You can use SMS_DRIVER
env for set default sms driver. (in local don't change it, by default it set fake driver)
And also can use VOICE_CALL_DRIVER
env. it is like SMS_DRIVER, but for voice call.
How to use
There are two option of using this package:
1- use Facades
2- use Channels
Working with Facades
You can use Sms
or VoiceCall
facades in anywhere of your code like this:
available methods:
to
: set the mobile number should get sms.message
: the text message can be a simple string or object of a class implement HoomanMirghasemi\Sms\Contracts\Message interfacesend
: send the message.
Working with Channels (use laravel notification classes)
Make a laravel notification class, set via SmsChannel
like this code:
Change condition of showing sms list page
By default when your laravel application is in production mode this page will response
- But if you want have a diffrent condition publish config file and change this part like this code or some thing you want:
now if you forgot to set app.env to production or temporary change it, it will be safe and return 404.
Create custom drivers:
Option A:
We welcome your participation, Create your driver and send a pull request.
Option A:
This package is using strategy design pattern and laravel Manager
class.
so you can easily make your driver like this:
And register it into manager class in any of your service providers class like this:
Events
You can listen for this event
- SmsSentEvent: Occurs when sms send. (the package use it to collect report into db)
Contributing
Please see CONDUCT for details.
Credits
- Hooman Mirghasemi
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-iran-sms with dependencies
kavenegar/laravel Version *
laravel/framework Version ^8.0|^9.0|^10.0|^11.0