PHPackages                             helios-ag/php\_rutils - 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. helios-ag/php\_rutils

ActiveLibrary

helios-ag/php\_rutils
=====================

RUtils is a Russian-specific string utils (transliteration, numeral is words, russian dates, typography)

00PHPCI passing

Since Apr 5Pushed 1mo agoCompare

[ Source](https://github.com/helios-ag/php_rutils)[ Packagist](https://packagist.org/packages/helios-ag/php_rutils)[ RSS](/packages/helios-ag-php-rutils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP RUtils
----------

[](#php-rutils)

Summary
-------

[](#summary)

[![License](https://camo.githubusercontent.com/189ddf6395e2e706f01d95e1f351eb92ef5428f446fe27fe264af8157637b408/68747470733a2f2f706f7365722e707567782e6f72672f68656c696f732d61672f7068705f727574696c732f6c6963656e7365)](https://packagist.org/packages/helios-ag/php_rutils)[![Latest Stable Version](https://camo.githubusercontent.com/73c739bbd035e082bc957572e1767332fcadf4ab9a273df3f7bfd47162dc6ba5/68747470733a2f2f706f7365722e707567782e6f72672f68656c696f732d61672f7068705f727574696c732f762f737461626c65)](https://packagist.org/packages/helios-ag/php_rutils)

[![Build Status](https://github.com/helios-ag/php_rutils/actions/workflows/tests.yml/badge.svg)](https://github.com/helios-ag/php_rutils/actions/workflows/tests.yml)

RUtils is a Russian-specific string utils (transliteration, numeral is words, russian dates, typography) for PHP. This is a port of the Python [Pytils](https://github.com/j2a/pytils) to PHP.

See additional docs and examples in [doc subdir](https://github.com/helios-ag/php_rutils/tree/main/doc).

Library is published on the Composer: [https://packagist.org/packages/helios-ag/php\_rutils](https://packagist.org/packages/helios-ag/php_rutils)

Requires PHP 8.3+.

---

RUtils — утилиты для работы c текстом на русском языке (транслитерация, числительные словами, русские даты, простая типографика) для языка PHP. RUtils — порт утилит [Pytils](https://github.com/j2a/pytils) на PHP.

Документацию и примеры смотрите в [каталоге doc](https://github.com/helios-ag/php_rutils/tree/main/doc).

Библиотека доступна через Composer: [https://packagist.org/packages/helios-ag/php\_rutils](https://packagist.org/packages/helios-ag/php_rutils)

[![Daily Downloads](https://camo.githubusercontent.com/c7df2b92567dcc4f7a182a06ef54ea63492be958335cef48d939da72ca19b36b/68747470733a2f2f706f7365722e707567782e6f72672f68656c696f732d61672f7068705f727574696c732f642f6461696c79)](https://packagist.org/packages/helios-ag/php_rutils)[![Monthly Downloads](https://camo.githubusercontent.com/bb2f09f1c9127215c8f9da71baf3784a049c0be695e57f3ad283e368fef23f95/68747470733a2f2f706f7365722e707567782e6f72672f68656c696f732d61672f7068705f727574696c732f642f6d6f6e74686c79)](https://packagist.org/packages/helios-ag/php_rutils)[![Total Downloads](https://camo.githubusercontent.com/d1034574d4abeba9f403ba10dce7c0223cfc03b2726c89cb831dbac4ed0f9cdd/68747470733a2f2f706f7365722e707567782e6f72672f68656c696f732d61672f7068705f727574696c732f646f776e6c6f616473)](https://packagist.org/packages/helios-ag/php_rutils)

---

Буду рад принять помощь по проекту в виде советов, баг-репортов и pull-реквестов.

Проект использует PSR-4 autoloading, [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) и [Psalm](https://psalm.dev/). Проверка стиля и статический анализ запускаются в CI и доступны локально через `Makefile`.

### Development

[](#development)

- Local dev environment: `docker compose up -d` or `make up`
- Shell in container: `make shell`
- Tests: `make test`
- Fix code style: `make cs-fix`
- Static analysis: `make psalm`
- VS Code / OpenCode devcontainer: `.devcontainer/devcontainer.json`
- Doc examples in `doc/examples/` run standalone.

Хочу сказать большое спасибо [всем людям](https://github.com/helios-ag/php_rutils/graphs/contributors), внесшим свой вклад в улучшение проекта.

---

Basic usage
-----------

[](#basic-usage)

Modules of PHP RUtils:

- Numeral - Plural forms and in-word representation for numerals
- Dt - Russian dates without locales and other dates handling
- Translit - Simple transliteration
- Typo - Basic russian typography

**Numeral**

Choosing the word form depending of a number:

```
$variants = [
    'гвоздь', //1
    'гвоздя', //2
    'гвоздей' //5
];
echo $amount, ' ', RUtils::numeral()->choosePlural(15, $variants);
//Result: 15 гвоздей

echo RUtils::numeral()->getPlural(2, $variants);
//Result: 2 гвоздя
```

Choosing the word form and print number in words:

```
echo RUtils::numeral()->sumString(1234, RUtils::MALE, $variants);
//Result: одна тысяча двести тридцать четыре гвоздя
```

Print number in words:

```
$numeral = RUtils::numeral();
echo $numeral->getInWordsInt(100);
//Result: сто

echo $numeral->getInWordsFloat(100.025);
//Result: сто целых двадцать пять тысячных

echo $numeral->getInWords(100.0);
//Result: сто
```

Print money (RUB):

```
echo RUtils::numeral()->getRubles(100.25);
//Result: сто рублей двадцать пять копеек
```

**Dt**

Today date: `\php_rutils\struct\TimeParams` - params structure, may be passed as array

```
$params = new TimeParams();
$params->date = null; //default value, 'now'
$params->format = 'сегодня d F Y года';
$params->monthInflected = true;
echo RUtils::dt()->ruStrFTime($params);
//Result: сегодня 22 октября 2013 года
```

Historical date:

```
$params = [
    'date' => '09-05-1945',
    'format' => 'l d F Y была одержана победа над немецко-фашистскими захватчиками',
    'monthInflected' => true,
    'preposition' => true,
];
echo RUtils::dt()->ruStrFTime($params);
//Result: в среду 9 мая 1945 была одержана победа над немецко-фашистскими захватчиками
```

Time interval to fixed date:

```
$toTime = new \DateTime('05-06-1945'); //Unix timestamp and string also available
echo RUtils::dt()->distanceOfTimeInWords($toTime), PHP_EOL;
//Result: 68 лет назад

$toTime = strtotime('05-06-1945');
$fromTime = null; //now
$accuracy = RUtils::ACCURACY_MINUTE; //years, months, days, hours, minutes
echo RUtils::dt()->distanceOfTimeInWords($toTime, $fromTime, $accuracy), PHP_EOL;
//Result: 68 лет, 4 месяца, 21 день, 19 часов, 12 минут назад
```

Time interval from fixed date to fixed date:

```
$fromTime = '1988-01-01 11:40';
$toTime = '2088-01-01 12:35';
$accuracy = RUtils::ACCURACY_MINUTE; //years, months, days, hours, minutes
echo RUtils::dt()->distanceOfTimeInWords($toTime, $fromTime, $accuracy), PHP_EOL;
//Result: через 100 лет, 55 минут
```

Age:

```
$birthDate = strtotime('today - 25 years');
echo RUtils::dt()->getAge($birthDate);
//Result: 25
```

**Translit**

```
//Translify
echo RUtils::translit()->translify('Муха - это маленькая птичка');
//Result: Muxa - e`to malen`kaya ptichka

//Detranslify
echo RUtils::translit()->detranslify("Muxa - e`to malen`kaya ptichka");
//Result: Муха - это маленькая птичка

//Prepare to use in URLs or file paths
echo RUtils::translit()->slugify('Муха — это маленькая птичка');
//Result: muha-eto-malenkaya-ptichka
```

**Typo**

```
$text = typography($text, [TypoRules::DASHES, TypoRules::CLEAN_SPACES]);
/**
 * Result:
 * ...Когда В. И. Пупкин увидел в газете (это была "Сермяжная правда" № 45) рубрику Weather Forecast (r),
 * он не поверил своим глазам — температуру обещали +-451F.
 */
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance60

Regular maintenance activity

Popularity0

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/fdaf9345391fb6aac209cff89d61dcb949999d4a6867212b30577831eb5bc8d8?d=identicon)[helios](/maintainers/helios)

---

Top Contributors

[![andre487](https://avatars.githubusercontent.com/u/1009104?v=4)](https://github.com/andre487 "andre487 (93 commits)")[![helios-ag](https://avatars.githubusercontent.com/u/334907?v=4)](https://github.com/helios-ag "helios-ag (13 commits)")[![githubjeka](https://avatars.githubusercontent.com/u/874234?v=4)](https://github.com/githubjeka "githubjeka (4 commits)")[![boldyrev](https://avatars.githubusercontent.com/u/740755?v=4)](https://github.com/boldyrev "boldyrev (1 commits)")[![kazip](https://avatars.githubusercontent.com/u/8566378?v=4)](https://github.com/kazip "kazip (1 commits)")[![walik91](https://avatars.githubusercontent.com/u/5238269?v=4)](https://github.com/walik91 "walik91 (1 commits)")

### Embed Badge

![Health badge](/badges/helios-ag-php-rutils/health.svg)

```
[![Health](https://phpackages.com/badges/helios-ag-php-rutils/health.svg)](https://phpackages.com/packages/helios-ag-php-rutils)
```

PHPackages © 2026

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