Download the PHP package shetabit/sms without Composer
On this page you can find all versions of the php package shetabit/sms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package sms
Short Description Laravel Sms Gateway Integration Package
License MIT
Homepage https://github.com/shetabit/sms
Informations about the package sms
Laravel Sms Gateway
This is a Laravel package for sms gateway integration. This package requires PHP 8.4+ and supports Laravel 12 and
Laravel 13.
Donate me if you like this package :sunglasses: :bowtie:
This package works with multiple drivers, and you can create custom drivers if you can't find them in the current drivers list below.
List of contents
- List of available drivers
- Install
- Configure
- How to use
- Send a message
- Choose a driver at runtime
- Change the settings of a driver at runtime
- Send to several recipients at once
- Use a template of the gateway
- Notifications
- Create custom drivers
- Testing
- Change log
- Contributing
- Security
- Credits
- License
List of available drivers
| Driver | Gateway | Needs |
|---|---|---|
clockwork |
Clockwork | composer require mediaburst/clockworksms |
farazsms |
Faraz SMS | — |
kavenegar |
Kavenegar | composer require kavenegar/php |
linkmobility |
LINK Mobility | — |
melipayamak |
Melipayamak | composer require melipayamak/php |
smsgatewayme |
SMSGateway.me | composer require smsgatewayme/client |
smsir |
SMS.ir | — |
sns |
Amazon SNS | composer require aws/aws-sdk-php |
textlocal |
Textlocal | — |
tsms |
TSMS | ext-soap |
twilio |
Twilio | composer require twilio/sdk |
Only the drivers you actually use have to be installed — the package itself pulls none of the gateway SDKs in.
Install
Via Composer
The service provider and the Sms facade are registered by package discovery, so there is nothing to add to
config/app.php.
Configure
Publish the configuration file:
The published config/sms.php holds three things: the driver that is used when none is named, the settings of every
driver and the class each driver name maps to.
Publishing is optional. The shipped configuration is merged in, so config('sms.drivers') is readable right after
installation and your own config/sms.php only has to carry the keys you want to change.
How to use
Send a message
send() returns the answer of the gateway: for a single recipient the bare answer, for several of them a Collection
keyed by recipient number.
Choose a driver at runtime
Change the settings of a driver at runtime
Several settings can be handed over at once:
config() overwrites the settings of the driver that is currently selected, so call it after via().
Send to several recipients at once
Use a template of the gateway
Gateways that deliver from a template of their own — Kavenegar's VerifyLookup for instance — are addressed through
the message:
Drivers that do not know templates ignore them and send the plain text instead.
Notifications
The package ships a notification channel. Let via() return it and build the message in a toSms() method:
toSms() has to hand back a Shetabit\Sms\Sms instance, or null to send nothing at all.
Create custom drivers
Add the settings of your driver to the drivers array and its class to the map array of config/sms.php:
The class has to extend Shetabit\Sms\Abstracts\Driver and implement sendTo(), which delivers the message to one
recipient and returns the answer of the gateway. Walking the list of recipients is the job of the abstract driver:
setting() and booleanSetting() read a single value out of the settings the driver was given.
Testing
Every pull request and every push to master is checked by GitHub Actions: the test suite runs on
PHP 8.4 and 8.5, against Laravel 12 and 13 and against both the lowest and the highest supported dependencies, the
coding style is checked with PHP_CodeSniffer, the sources are analysed with PHPStan and the code coverage of the test
suite is measured and has to stay above 95%.
No test talks to a gateway. The driver tests answer the HTTP calls of a driver from a queue of prepared responses, and
the drivers that go through an SDK of their own are given a fake of that SDK — see tests/Unit/Drivers/DriverTestCase.php
and tests/Fakes/. The feature tests boot a real Laravel application with Testbench and send through a driver that
records what it was asked to deliver.
You can run the same checks locally. With PHP and Composer installed on your machine:
If you would rather not install PHP on your machine, the shipped Dockerfile and Makefile run everything inside a
container:
Another PHP version can be used with make test PHP_VERSION=8.5, and a single Laravel version with
make test-laravel LARAVEL=12.
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Mahdi khanzadi
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of sms with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^7.9|^8.0
illuminate/contracts Version ^12.0|^13.0
illuminate/notifications Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0