PHPackages                             dejwcake/sms-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dejwcake/sms-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dejwcake/sms-client
===================

A generic SMS client library. Supports multiple swappable drivers.

3.0.1(4mo ago)01911MITPHPPHP ^8.4

Since Sep 23Pushed 4mo agoCompare

[ Source](https://github.com/dejwCake/sms-client)[ Packagist](https://packagist.org/packages/dejwcake/sms-client)[ RSS](/packages/dejwcake-sms-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (24)Used By (1)

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
---------

[](#fork-note)

This project is a fork of `Matthewbdaly\SMS`. It is maintained and improved by David Běhal (`DejwCake`).

Namespace change
----------------

[](#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
-------

[](#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
-------------

[](#example-usage)

**Null**

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\Response;
use DejwCake\SmsClient\Drivers\NullDriver;
use DejwCake\SmsClient\Client;

$guzzle = new GuzzleClient;
$resp = new Response;
$driver = new NullDriver($guzzle, $resp);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$client->send($msg);
```

**Log**

```
use DejwCake\SmsClient\Drivers\Log;
use DejwCake\SmsClient\Client;
use Psr\Log\LoggerInterface;

$driver = new Log($logger); // $logger should be an implementation of Psr\Log\LoggerInterface
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$client->send($msg);
```

**RequestBin**

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\Response;
use DejwCake\SmsClient\Drivers\RequestBin;
use DejwCake\SmsClient\Client;

$guzzle = new GuzzleClient;
$resp = new Response;
$driver = new RequestBin($guzzle, $resp, [
    'path' => 'MY_REQUESTBIN_PATH',
]);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$client->send($msg);
```

**Clockwork**

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\Response;
use DejwCake\SmsClient\Drivers\Clockwork;
use DejwCake\SmsClient\Client;

$guzzle = new GuzzleClient;
$resp = new Response;
$driver = new Clockwork($guzzle, $resp, [
    'api_key' => 'MY_CLOCKWORK_API_KEY',
]);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$client->send($msg);
```

**Nexmo**

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\Response;
use DejwCake\SmsClient\Drivers\Nexmo;
use DejwCake\SmsClient\Client;

$guzzle = new GuzzleClient;
$resp = new Response;
$driver = new Nexmo($guzzle, $resp, [
    'api_key' => 'MY_NEXMO_API_KEY',
    'api_secret' => 'MY_NEXMO_API_SECRET',
]);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'from'    => 'Test User',
    'content' => 'Just testing',
];
$client->send($msg);
```

**AWS SNS**

```
use DejwCake\SmsClient\Client;
use DejwCake\SmsClient\Drivers\Aws;

$config = [
    'api_key'    => 'foo',
    'api_secret' => 'bar',
    'api_region' => 'ap-southeast-2'
];
$driver = new Aws($config);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'from'    => 'Test User',
    'content' => 'Just testing',
];
$client->send($msg);
```

**Mail**

```
use DejwCake\SmsClient\Client;
use DejwCake\SmsClient\Drivers\Mail;
use DejwCake\SmsClient\Contracts\Mailer;

$config = [
    'domain' => 'my.sms-gateway.com'
];
$driver = new Mail($mailer, $config);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$client->send($msg);
```

**TextLocal**

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\Response;
use DejwCake\SmsClient\Drivers\TextLocal;
use DejwCake\SmsClient\Client;

$guzzle = new GuzzleClient;
$resp = new Response;
$driver = new TextLocal($guzzle, $resp, [
    'api_key' => 'MY_TEXTLOCAL_API_KEY',
]);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'from'    => 'Test User',
    'content' => 'Just testing',
];
$client->send($msg);
```

**Twilio**

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\Response;
use DejwCake\SmsClient\Drivers\Twilio;
use DejwCake\SmsClient\Client;

$guzzle = new GuzzleClient;
$resp = new Response;
$driver = new Twilio($guzzle, $resp, [
    'account_id' => 'MY_TWILIO_ACCOUNT_ID',
    'api_token' => 'MY_TWILIO_API_TOKEN',
]);
$client = new Client($driver);
$msg = [
    'to'      => '+44 01234 567890',
    'from'      => '+44 01234 567890',
    'content' => 'Just testing',
];
$client->send($msg);
```

**O2SK**

```
use GuzzleHttp\Client as GuzzleClient;
use DejwCake\SmsClient\Drivers\O2SK;
use DejwCake\SmsClient\Client;

$driver = new O2SK(new GuzzleClient, [
    'apiKey' => 'MY_O2SK_API_KEY',
]);
$client = new Client($driver);
$msg = [
    'message' => 'Testing message',
    'sender' => ['text' => 'Tester'],
    'recipients' => [
        ['phonenr' => '+421911000000']
    ]
];
$client->send($msg);
```

Mail driver
-----------

[](#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
-----------------------------

[](#laravel-and-lumen-integration)

Using Laravel or Lumen? You probably want to use [my integration package](https://packagist.org/packages/dejwcake/laravel-sms) rather than this one, since that includes a service provider, as well as the `SMS` facade and easier configuration.

Creating your own driver
------------------------

[](#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
---------------------------

[](#how-to-develop-this-project)

### Composer

[](#composer)

Update dependencies:

```
docker compose run --rm cli composer update
```

Composer normalization:

```
docker compose run --rm php-qa composer normalize
```

### Run tests

[](#run-tests)

Run tests with pcov:

```
docker compose run --rm test ./vendor/bin/phpunit -d pcov.enabled=1
```

### Run code analysis tools (php-qa)

[](#run-code-analysis-tools-php-qa)

PHP compatibility:

```
docker compose run --rm php-qa phpcs --standard=.phpcs.compatibility.xml --cache=.phpcs.cache
```

Code style:

```
docker compose run --rm php-qa phpcs -s --colors --extensions=php
```

Fix style issues:

```
docker compose run --rm php-qa phpcbf -s --colors --extensions=php
```

Static analysis (phpstan):

```
docker compose run --rm php-qa phpstan analyse --configuration=phpstan.neon
```

Mess detector (phpmd):

```
docker compose run --rm php-qa phpmd ./src,./tests ansi phpmd.xml --suffixes php --baseline-file phpmd.baseline.xml
```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance74

Regular maintenance activity

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 97.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~136 days

Recently: every ~309 days

Total

23

Last Release

147d ago

Major Versions

1.0.16 → 2.0.02022-07-26

v2.x-dev → 3.0.02025-12-13

PHP version history (2 changes)2.0.0PHP ^8.1

3.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/7587c47435caa968be9a652630c6c0c91abacb43dfa001b02cbe5b892672cd7e?d=identicon)[dejwCake](/maintainers/dejwCake)

---

Top Contributors

[![matthewbdaly](https://avatars.githubusercontent.com/u/450801?v=4)](https://github.com/matthewbdaly "matthewbdaly (144 commits)")[![laramoore](https://avatars.githubusercontent.com/u/50185207?v=4)](https://github.com/laramoore "laramoore (2 commits)")[![dejwCake](https://avatars.githubusercontent.com/u/22255647?v=4)](https://github.com/dejwCake "dejwCake (1 commits)")[![mohavee](https://avatars.githubusercontent.com/u/24735528?v=4)](https://github.com/mohavee "mohavee (1 commits)")

---

Tags

sms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dejwcake-sms-client/health.svg)

```
[![Health](https://phpackages.com/badges/dejwcake-sms-client/health.svg)](https://phpackages.com/packages/dejwcake-sms-client)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[matthewbdaly/sms-client

A generic SMS client library. Supports multiple swappable drivers.

2291.2k2](/packages/matthewbdaly-sms-client)[midnite81/geolocation

A laravel package which wraps the IP Info DB and IP2Location Services

3624.1k](/packages/midnite81-geolocation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
