PHPackages                             webregul/sms-ru-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. webregul/sms-ru-client

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

webregul/sms-ru-client
======================

sms.ru client

v2.0.1(3y ago)0178↓50%1MITPHPPHP ^8.0

Since Mar 20Pushed 3y agoCompare

[ Source](https://github.com/WebRegul/sms-ru-client)[ Packagist](https://packagist.org/packages/webregul/sms-ru-client)[ Docs](https://github.com/webregul/sms-ru-client)[ RSS](/packages/webregul-sms-ru-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (1)

API Client for sms.ru notification service
==========================================

[](#api-client-for-smsru-notification-service)

[![test](https://github.com/kafkiansky/sms-ru-client/workflows/test/badge.svg?event=push)](https://github.com/kafkiansky/sms-ru-client/workflows/test/badge.svg?event=push)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Quality Score](https://camo.githubusercontent.com/b20d8b36785e0010220ee81094e489514fef80bc342e287eb38213b932440c46/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b61666b69616e736b792f736d732d72752d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/kafkiansky/sms-ru-client)[![StyleCI](https://camo.githubusercontent.com/48047330233cd385432957b0568e08e1adb963c18669a4fc7795afd2be734d06/68747470733a2f2f7374796c6563692e696f2f7265706f732f3236313239303935352f736869656c64)](https://styleci.io/repos/261290955)[![Total Downloads](https://camo.githubusercontent.com/ca3c4eb141f80e228629d92357c6056450d25524580e743979f4d7909d732317/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61666b69616e736b792f736d732d72752d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kafkiansky/sms-ru-client)[![Codecov](https://camo.githubusercontent.com/10e9897ed0f8f9cf1da13c39e190e0f4c4f54b93afe29c83f6b0cc24020716a6/68747470733a2f2f636f6465636f762e696f2f67682f6b61666b69616e736b792f736d732d72752d636c69656e742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/kafkiansky/sms-ru-client)

### Contents:

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Configuration](#configuration)
    - [Available methods](#available-methods)
        - [Send](#send)
        - [Cost](#cost)
        - [Balance](#balance)
        - [Limit](#limit)
        - [Senders](#senders)
- [Testing](#testing)
- [License](#license)

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

[](#installation)

Install this package with Composer:

```
composer require webregul/sms-ru-client
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

Package provide simple configuration, just fill SmsRuConfig with follow configuration:

```
require __DIR__ . '/vendor/autoload.php';

$api = new \Kafkiansky\SmsRu\SmsRuApi(
    new \Kafkiansky\SmsRu\SmsRuConfig(
        [
            'api_id' => 'XXXXX-XXXX-XXXXX',
            'test'   => 1,
            'json'   => 1,
        ]
    ),
    new \GuzzleHttp\Client()
);
```

Put `test` parameter to 1 to prevent real money spending in test environment. You also can use your login/password to make requests, but it safe just when using https:

```
$api = new \Kafkiansky\SmsRu\SmsRuApi(
    new \Kafkiansky\SmsRu\SmsRuConfig(
        [
            'login' => 'secret',
            'password' => 'secret',
            'test'   => 1,
            'json'   => 1,
        ]
    ),
    new \GuzzleHttp\Client()
);
```

### Available methods

[](#available-methods)

#### Send

[](#send)

1. One client - one message

```
require __DIR__ . '/vendor/autoload.php';

$api = new \Kafkiansky\SmsRu\SmsRuApi(
    new \Kafkiansky\SmsRu\SmsRuConfig(
        [
            'api_id' => 'XXXXX-XXXX-XXXXX',
            'test'   => 1,
            'json'   => 1,
        ]
    ),
    new \GuzzleHttp\Client()
);

$response = $api->send(
    new \Kafkiansky\SmsRu\Message\SmsRuMessage(
        new \Kafkiansky\SmsRu\Message\To('7909000000', 'Hello')
    )
);
```

2. Many clients - one message

```
$response = $api->send(
    new \Kafkiansky\SmsRu\Message\SmsRuMessage(
        new \Kafkiansky\SmsRu\Message\To(['7909000000', '7909111111'], 'Hello')
    )
);
```

3. Many clients - many messages

```
$response = $api->send(
    new \Kafkiansky\SmsRu\Message\SmsRuMessage(
        new \Kafkiansky\SmsRu\Message\Multi([
            new \Kafkiansky\SmsRu\Message\To('7909000000', 'Hello'),
            new \Kafkiansky\SmsRu\Message\To('7909111111', 'Bonjour'),
        ])
    )
);
```

The SmsRuMessage has many other parameters: you can specify user ip, ttl, time, daytime and translit. Read [documentation](https://sms.ru/api/send) for a full explanation. Usage is simple:

```
$response = $api->send(
    (new \Kafkiansky\SmsRu\Message\SmsRuMessage(
        new \Kafkiansky\SmsRu\Message\Multi([
            new \Kafkiansky\SmsRu\Message\To('7909000000', 'Hello'),
            new \Kafkiansky\SmsRu\Message\To('7909111111', 'Bonjour'),
        ])
    ))
      ->enableDaytime()
      ->enableTranslit()
      ->withTime(1000)
);
```

Or use static call:

```
$response = $api->send(
    \Kafkiansky\SmsRu\Message\SmsRuMessage::fromRecipient(
        new \Kafkiansky\SmsRu\Message\Multi([
            new \Kafkiansky\SmsRu\Message\To('7909000000', 'Hello'),
            new \Kafkiansky\SmsRu\Message\To('7909111111', 'Bonjour'),
        ])
    )
      ->enableDaytime()
      ->enableTranslit()
      ->withTime(1000)
);
```

If need, you can use iconv to convert encoding, just put `true` as second argument in `Multi` type:

```
new \Kafkiansky\SmsRu\Message\Multi([
     new \Kafkiansky\SmsRu\Message\To('7909000000', 'Hello'),
     new \Kafkiansky\SmsRu\Message\To('7909111111', 'Bonjour'),
], true);
```

And as third argument in `To`:

```
new \Kafkiansky\SmsRu\Message\To('7909000000', 'Hello', true);
```

#### Cost

[](#cost)

You can get cost for batch of messages:

```
$response = $api->cost(
    new \Kafkiansky\SmsRu\Message\SmsRuMessage(
        new \Kafkiansky\SmsRu\Message\Multi([
            new \Kafkiansky\SmsRu\Message\To('7909000000', 'Hello'),
            new \Kafkiansky\SmsRu\Message\To('7909111111', 'Bonjour'),
        ])
    )
);

echo $response->getTotalCost();
```

#### Balance

[](#balance)

```
$response = $api->balance();

echo $response->getBalance();
```

#### Limit

[](#limit)

```
$response = $api->limit();

echo $response->getTotalLimit();
echo $response->getUsedToday();
```

#### Senders

[](#senders)

```
$response = $api->senders();

echo $response->getSenders();
```

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~22 days

Total

3

Last Release

1103d ago

Major Versions

v1.0.1 → v2.0.02023-05-02

PHP version history (2 changes)v1.0.1PHP ^7.2

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d081a186978d91981ca1f659d5e0ddf67b741edab92cfb994efb3cd9f27708e?d=identicon)[WebRegul](/maintainers/WebRegul)

---

Top Contributors

[![kafkiansky](https://avatars.githubusercontent.com/u/37590388?v=4)](https://github.com/kafkiansky "kafkiansky (32 commits)")[![WebRegul](https://avatars.githubusercontent.com/u/17101107?v=4)](https://github.com/WebRegul "WebRegul (2 commits)")[![x2e8](https://avatars.githubusercontent.com/u/95776582?v=4)](https://github.com/x2e8 "x2e8 (2 commits)")

---

Tags

sms.ru

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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