PHPackages                             papalapa/laravel-smsc - 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. papalapa/laravel-smsc

ActiveLibrary

papalapa/laravel-smsc
=====================

Send SMS codes through SMSC.ru gateway

03541PHP

Since Apr 30Pushed 5y ago1 watchersCompare

[ Source](https://github.com/papalapa/laravel-smsc)[ Packagist](https://packagist.org/packages/papalapa/laravel-smsc)[ RSS](/packages/papalapa-laravel-smsc/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel SMSC
============

[](#laravel-smsc)

This package can be used for sending SMS-messages and SMS-codes through SMSC.ru

Installation
------------

[](#installation)

```
composer require papalapa/laravel-smsc
```

```
php artisan vendor:publish --provider="Papalapa\Laravel\Smsc\SmscServiceProvider"
```

```
php artisan migrate
```

Next settings are available for change in ./config/smsc.php:

```
return [

    // API URL
    'api_url' => 'https://smsc.ru/sys/send.php',

    // API Login and Password
    'api_login' => env('SMSC_LOGIN'),
    'api_password' => env('SMSC_PASSWORD'),

    // Sender name
    'sender_name' => env('SMSC_SENDER_NAME'),

    // Uses fake send
    // SMS will be stored in application log
    'fake_send' => env('SMSC_FAKE_SEND', true),

    // Code size
    // Max size is 6
    'code_size' => env('SMSC_CODE_SIZE', 6),

    // Lifetime of code and token in seconds
    'code_lifetime' => env('SMSC_CODE_LIFETIME', 120),
    'token_lifetime' => env('SMSC_TOKEN_LIFETIME', 600),

    // Connection for queueing jobs to be send
    // NULL - uses default app queue connection
    'queue_connection' => env('SMSC_QUEUE_CONNECTION'),

    // Throttle requests to using SMS-API
    // Max tries per minute
    'throttling_limit' => env('SMSC_THROTTLING_LIMIT', 2),

];
```

How to use for SMS-code checking:
---------------------------------

[](#how-to-use-for-sms-code-checking)

```
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Papalapa\Laravel\Smsc\PhoneNumber;
use Papalapa\Laravel\Smsc\Services\MessageHandler;

class SmsController
{
    public function sendCode(
        Request $request,
        MessageHandler $messageHandler,
    ): array {
        $tel = PhoneNumber::fromString($request->input('tel'));
        $sms = $messageHandler->sendCode($tel);

        return ['sent_to' => $sms->phoneNumber()->numeric()];
    }

    public function checkCode(
        Request $request,
        MessageHandler $messageHandler,
    ): array {
        $tel = PhoneNumber::fromString($request->input('tel'));
        $code = $request->input('code');

        if ($messageHandler->validateCode($tel, $code)){
            $token = $messageHandler->generateToken($tel);
            return compact('token');
        }

        throw ValidationException::withMessages([
            'code' => 'Code is invalid',
        ]);
    }
}
```

You can use middleware to validate tokenized requests:

```
use Illuminate\Support\Facades\Route;
use Papalapa\Laravel\Smsc\Middlewares\TokenizedPhoneNumber;

return [
    Route::middleware(TokenizedPhoneNumber::class)
        ->post('proceed', [AccountController::class, 'proceedWithToken']);
];
```

Then use decrypted-token-phone-number in controller action:

```
use Illuminate\Http\Request;
use Papalapa\Laravel\Smsc\Middlewares\TokenizedPhoneNumber;

class AccountController
{
    public function proceedWithTokenUsingMiddleware(Request $request): array
    {
        $tel = TokenizedPhoneNumber::getPhoneNumber($request);

        return ['phone_number' => $tel->numeric()];
    }
}
```

or validate the token directly in controller action:

```
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Papalapa\Laravel\Smsc\Exceptions\DecryptTokenException;
use Papalapa\Laravel\Smsc\Exceptions\ExpiredTokenException;
use Papalapa\Laravel\Smsc\Exceptions\InvalidTokenException;
use Papalapa\Laravel\Smsc\Services\TokenGenerator;

class AccountController
{
    public function proceedWithTokenAndWithoutMiddleware(
        Request $request,
        TokenGenerator $tokenGenerator,
    ): array
    {
        try {
            $tel = $tokenGenerator->validate($request->input('token'));
        } catch (InvalidTokenException|ExpiredTokenException|DecryptTokenException $e) {
            throw ValidationException::withMessages([
                'token' => $e->getMessage()
            ]);
        }

        return ['phone_number' => $tel->numeric()];
    }
}
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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/49ee8a513f2c7e607f87aedbba4f1281072b684083062c4e8a7943d580e16a3d?d=identicon)[papalapa](/maintainers/papalapa)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/papalapa-laravel-smsc/health.svg)

```
[![Health](https://phpackages.com/badges/papalapa-laravel-smsc/health.svg)](https://phpackages.com/packages/papalapa-laravel-smsc)
```

PHPackages © 2026

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