PHPackages                             andre\_487/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. andre\_487/php\_rutils

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

andre\_487/php\_rutils
======================

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

1.2.0(10y ago)219191.6k↑15.5%42[5 issues](https://github.com/Andre-487/php_rutils/issues)[1 PRs](https://github.com/Andre-487/php_rutils/pulls)1MITPHPPHP &gt;=5.3.0

Since Oct 26Pushed 5y ago22 watchersCompare

[ Source](https://github.com/Andre-487/php_rutils)[ Packagist](https://packagist.org/packages/andre_487/php_rutils)[ Docs](https://github.com/Andre-487/php_rutils)[ RSS](/packages/andre-487-php-rutils/feed)WikiDiscussions master Synced 1mo ago

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

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

[](#php-rutils)

Больше не поддерживается
------------------------

[](#больше-не-поддерживается)

Summary
-------

[](#summary)

[![License](https://camo.githubusercontent.com/e4275913dd4385731068797a96600c32164986da97395a12dfaca9015d24471e/68747470733a2f2f706f7365722e707567782e6f72672f616e6472655f3438372f7068705f727574696c732f6c6963656e7365)](https://packagist.org/packages/andre_487/php_rutils)[![Latest Stable Version](https://camo.githubusercontent.com/46af8ce85fe378e95ad0c013f1c89e9d2dac2c41e05009721753e2f8630278d1/68747470733a2f2f706f7365722e707567782e6f72672f616e6472655f3438372f7068705f727574696c732f762f737461626c65)](https://packagist.org/packages/andre_487/php_rutils)

[![Build Status](https://camo.githubusercontent.com/45b072ef35b88a51e56058cf76ec4b42b3a0be8965f9a39d38ae0a2a6cff53c4/68747470733a2f2f7472617669732d63692e6f72672f416e6472652d3438372f7068705f727574696c732e737667)](https://travis-ci.org/Andre-487/php_rutils)[![Code Climate](https://camo.githubusercontent.com/197acb95359d5ef5a31e15b5e81198dd62b6e43248c32fa8f92eed94d74c0eb4/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f416e6472652d3438372f7068705f727574696c732f6261646765732f6770612e737667)](https://codeclimate.com/github/Andre-487/php_rutils)

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/Andre-487/php_rutils/tree/master/doc).

Library is published on the Composer: [https://packagist.org/packages/andre\_487/php\_rutils](https://packagist.org/packages/andre_487/php_rutils)

---

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

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

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

[![Daily Downloads](https://camo.githubusercontent.com/a66dd284192a208ef86678060ada5b577d5271d00487be18a5e3ff69e0e5b3a9/68747470733a2f2f706f7365722e707567782e6f72672f616e6472655f3438372f7068705f727574696c732f642f6461696c79)](https://packagist.org/packages/andre_487/php_rutils)[![Monthly Downloads](https://camo.githubusercontent.com/b80f0d6aca63a199a6fd457d0fb0aaea9b510f84cc1a52d7bb2aec4891e9add0/68747470733a2f2f706f7365722e707567782e6f72672f616e6472655f3438372f7068705f727574696c732f642f6d6f6e74686c79)](https://packagist.org/packages/andre_487/php_rutils)[![Total Downloads](https://camo.githubusercontent.com/bd57f90225ff8ce0cc4bb7e6c6e1f579c2493244183202a57ebd9aca3ec5e6eb/68747470733a2f2f706f7365722e707567782e6f72672f616e6472655f3438372f7068705f727574696c732f646f776e6c6f616473)](https://packagist.org/packages/andre_487/php_rutils)

---

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

Проект следует стилю кодирования [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Стиль проверяется с помощью [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)на этапе CI.

Хочу сказать большое спасибо [всем людям](https://github.com/Andre-487/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 = array(
    'гвоздь', //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 = array(
    '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, array(TypoRules::DASHES, TypoRules::CLEAN_SPACES));
/**
 * Result:
 * ...Когда В. И. Пупкин увидел в газете (это была "Сермяжная правда" № 45) рубрику Weather Forecast (r),
 * он не поверил своим глазам — температуру обещали +-451F.
 */
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 93% 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 ~364 days

Total

3

Last Release

3859d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4bbe41fc23dc4293fe272ab60f7eb6f012196f864bcb9dd6e0dfe27ed96e39f1?d=identicon)[Andre-487](/maintainers/Andre-487)

---

Top Contributors

[![andre487](https://avatars.githubusercontent.com/u/1009104?v=4)](https://github.com/andre487 "andre487 (93 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)")

---

Tags

typographytransliterationnumeral is wordsrussian dates

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/andre-487-php-rutils/health.svg)

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

###  Alternatives

[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[ausi/slug-generator

Slug Generator

8002.2M22](/packages/ausi-slug-generator)[jolicode/jolitypo

Microtypography fixer for the web.

3471.1M5](/packages/jolicode-jolitypo)[michelf/php-smartypants

PHP SmartyPants

1115.3M30](/packages/michelf-php-smartypants)[voku/urlify

PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.

254.1M7](/packages/voku-urlify)[fresh/transliteration

PHP library for transliteration.

52135.6k1](/packages/fresh-transliteration)

PHPackages © 2026

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