Download the PHP package dejwcake/sms-client without Composer
On this page you can find all versions of the php package dejwcake/sms-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sms-client
sms-client
A generic SMS client library. Supports multiple swappable drivers, so that you're never tied to just one provider.
This library is aimed squarely at sending SMS messages only, and I don't plan to add support for other functionality. The idea is to create one library that should be able to work with any provider that has a driver for the purpose of sending SMS messages.
Fork note
This project is a fork of Matthewbdaly\SMS. It is maintained and improved by David Běhal (DejwCake).
Namespace change
The library namespace has been updated from Matthewbdaly\SMS to DejwCake\SmsClient. Backward compatibility with the old namespace has been removed; please update your imports accordingly.
Drivers
It currently ships with the following drivers:
- Clockwork
- Nexmo
- TextLocal
- Twilio
- AWS SNS (requires installation of
aws/aws-sdk-php) - Mail (for mail-to-SMS gateways)
- O2SK (O2 Slovakia)
In addition, it also has the following drivers for test purposes:
- RequestBin
- Null
- Log
The RequestBin sends the POST request to the specified RequestBin path for debugging. The Null driver does nothing, while the Log driver accepts a PSR3 logger and uses it to log the request.
Example Usage
Null
Log
RequestBin
Clockwork
Nexmo
AWS SNS
TextLocal
Twilio
O2SK
Mail driver
I have implemented a mail driver at DejwCake\SmsClient\Drivers\Mail, but it's very basic and may not work with a lot of mail-to-SMS gateways out of the box. It accepts an instance of the DejwCake\SmsClient\Contracts\Mailer interface as the first argument, and the config array as the second.
I've included the class DejwCake\SmsClient\PHPMailAdapter in the library as a very basic implementation of the mailer interface, but it's deliberately very basic - it's just a very thin wrapper around the PHP mail() function. You will almost certainly want to create your own implementation for your own use case - for instance, if you're using Laravel you might create a wrapper class for the Mail facade.
The mail driver will nearly always be slower and less reliable than the HTTP-based ones, so if you have to integrate with a provider that doesn't yet have a driver, but does have a REST API, you're probably better off creating an API driver for it. If you do need to work with a mail-to-SMS gateway, you're quite likely to find that you need to extend DejwCake\SmsClient\Drivers\Mail to amend the functionality.
Laravel and Lumen integration
Using Laravel or Lumen? You probably want to use my integration package rather than this one, since that includes a service provider, as well as the SMS facade and easier configuration.
Creating your own driver
It's easy to create your own driver - just implement the DejwCake\SmsClient\Contracts\Driver interface. You can use whatever method is most appropriate for sending the SMS - for instance, if your provider has a mail-to-SMS gateway, you can happily use Swiftmailer or PHPMailer in your driver to send emails, or if they have a REST API you can use Guzzle.
You can pass any configuration options required in the config array in the constructor of the driver. Please ensure that your driver has tests using PHPUnit and that it meets the coding standard (the package includes a PHP Codesniffer configuration for that reason).
If you've created a new driver, feel free to submit a pull request and I'll consider including it.
How to develop this project
Composer
Update dependencies:
Composer normalization:
Run code analysis tools (php-qa)
PHP compatibility:
Code style:
Fix style issues:
Static analysis (phpstan):
Regenerate the phpstan baseline:
Mess detector (phpmd):
Regenerate the phpmd baseline:
Run tests
Run tests:
Run tests with coverage:
Run the whole PHP suite
Run every PHP check and the test suite in sequence (stops at the first failure):
All versions of sms-client with dependencies
aws/aws-sdk-php Version ^3.367
guzzlehttp/guzzle Version ^7.10
psr/log Version ^3.0