PHPackages                             apiaryhq/silex-sms-login-provider - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. apiaryhq/silex-sms-login-provider

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

apiaryhq/silex-sms-login-provider
=================================

SMS based login service for Silex

313PHP

Since Nov 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/apiaryhq/silex-sms-login-provider)[ Packagist](https://packagist.org/packages/apiaryhq/silex-sms-login-provider)[ RSS](/packages/apiaryhq-silex-sms-login-provider/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Silex SMS Login Provider
========================

[](#silex-sms-login-provider)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f4566887c5ff5021e01bbfb758ddae965706ea8b07ce973542105625f24e3c92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61706961727968712f73696c65782d736d732d6c6f67696e2d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/apiaryhq/silex-sms-login-provider)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/818d02658ff0e6ddbdbb5bcfbb081ac1e750330244039c0d73b6a1b476f0e0d1/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f61706961727968712f73696c65782d736d732d6c6f67696e2d70726f76696465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/apiaryhq/silex-sms-login-provider)[![Coverage Status](https://camo.githubusercontent.com/d885bebe481734c7e6a41b5abf403887ba62f4e6d9aa346e6ad28e251cb5f065/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f61706961727968712f73696c65782d736d732d6c6f67696e2d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/apiaryhq/silex-sms-login-provider/code-structure)[![Quality Score](https://camo.githubusercontent.com/33488672df50369e888e22965621e323ca12a6380be2f7302f1e6c038053a38b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f61706961727968712f73696c65782d736d732d6c6f67696e2d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/apiaryhq/silex-sms-login-provider)[![Total Downloads](https://camo.githubusercontent.com/43a7d61805f115410c1a7b13876398885e62bdf861b779a5d31739d5163ac22c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61706961727968712f73696c65782d736d732d6c6f67696e2d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/apiaryhq/silex-sms-login-provider)

Silex add on to provide SMS based login service. This is a 2-step process. First the user enters their mobile phone number, an SMS is sent to their phone that contains a login code. The user enters the code to validate the session and login.

This package is compliant with PSR-1, PSR-2 and PSR-4. If you notice compliance oversights, please send a patch via pull request.

Install
-------

[](#install)

Via Composer

```
$ composer require apiaryhq/silex-sms-login-provider
```

Usage
-----

[](#usage)

To use SMS login, register an SMS handler. This is a service that supports the SmsHandlerInterface. An inplementation is provided that uses [Twilio](https://www.twilio.com/) to send SMS messages.

```
$accountSid = getenv('TWILIO_ACCOUNT_SID');
$authToken = getenv('TWILIO_AUTH_TOKEN');
$app->register(new TwilioSMSHandlerProvider(), [
    'sms.handler.from' => 'Daz',
    'sms.handler.twilio_sid' => $accountSid,
    'sms.handler.twilio_auth_token' => $authToken,
]);
```

Use the provider to register services and controller:

```
$smsLoginProvider = new SmsLoginProvider();
$app->register($smsLoginProvider);
$app->mount('', $smsLoginProvider);
```

Protect an area of the site with SMS login:

```
$app['security.firewalls'] = array(
    // Login page is accessible to all:
    'login' => array(
        'pattern' => '^/login$',
    ),
    // Everything else is secured:
    'secured_area' => array(
        'pattern' => '^.*$',
        'sms' => true,
        'logout' => ['logout_path' => '/logout'],
        'users' => $app->share(function($app) { return $app['user.manager']; }),
    ),
);
```

Note that the `$app['user.manager']` must be an implementation of `UserProviderInterface`and also provide mobile phone numbers as usernames.

\## Debug mode

If you don't want to send SMS messages during development you can activate the SMS debug mode. In this case the verification code is not sent to the the phone number, but is instead concatenated to the number for display on the verification form. Obviously, this should never be enabled on production or you'll have no security at all!

```
$app['sms.debug'] = true;
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Darren Mothersele](http://www.darrenmothersele.com/)
- [All Contributors](../../contributors)

[Skeleton](https://github.com/thephpleague/skeleton/) package from The PHP League.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f0ce40e51bf1fb3ba86b4a566dbbb0a26e8792e1b9418228324e26e7450f42b?d=identicon)[darrenmothersele](/maintainers/darrenmothersele)

---

Top Contributors

[![darrenmothersele](https://avatars.githubusercontent.com/u/230337?v=4)](https://github.com/darrenmothersele "darrenmothersele (26 commits)")

### Embed Badge

![Health badge](/badges/apiaryhq-silex-sms-login-provider/health.svg)

```
[![Health](https://phpackages.com/badges/apiaryhq-silex-sms-login-provider/health.svg)](https://phpackages.com/packages/apiaryhq-silex-sms-login-provider)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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