vbudkodev / russian-date-grammatical-helper
PHP helper for Russian date components with grammatical cases support
Package info
github.com/vbudkodev/russian-date-grammatical-helper
pkg:composer/vbudkodev/russian-date-grammatical-helper
v1.0.0
2025-10-17 10:54 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^10.0
README
A lightweight PHP library for working with Russian date components with full grammatical cases support. Perfect for generating grammatically correct date phrases in Russian.
Installation
composer require vbudkodev/russian-date-grammatical-helper
Current Features
Month Names with Grammatical Cases
use RussianDateGrammaticalHelper\MonthHelper; use RussianDateGrammaticalHelper\GrammaticalCase; // Basic usage echo MonthHelper::name(1); // 'январь' (nominative) // Specific cases echo MonthHelper::name(1, GrammaticalCase::GENITIVE); // 'января' echo MonthHelper::name(1, GrammaticalCase::PREPOSITIONAL); // 'январе' // Prepositional phrase echo MonthHelper::in(5); // 'в мае' // All forms at once $forms = MonthHelper::forms(3); echo $forms[GrammaticalCase::NOMINATIVE->value]; // 'март' echo $forms[GrammaticalCase::GENITIVE->value]; // 'марта'
Available Cases
All six Russian grammatical cases are supported via the Case enum:
GrammaticalCase::NOMINATIVE- Именительный (кто? что?)GrammaticalCase::GENITIVE- Родительный (кого? чего?)GrammaticalCase::DATIVE- Дательный (кому? чему?)GrammaticalCase::ACCUSATIVE- Винительный (кого? что?)GrammaticalCase::INSTRUMENTAL- Творительный (кем? чем?)GrammaticalCase::PREPOSITIONAL- Предложный (о ком? о чём?)
Roadmap
- Day of week names with cases
- Year formatting (e.g., "в 2026 году")
- Full date formatting helpers
- Seasonal and relative date phrases
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.