{"id":16414572,"url":"https://github.com/wapmorgan/morphos-twig","last_synced_at":"2025-03-23T06:31:25.346Z","repository":{"id":62546561,"uuid":"80775613","full_name":"wapmorgan/Morphos-Twig","owner":"wapmorgan","description":"Morphos adapter for Twig","archived":false,"fork":false,"pushed_at":"2019-07-09T04:08:48.000Z","size":15,"stargazers_count":9,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T18:42:13.897Z","etag":null,"topics":["morphology","twig","twig-extension"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wapmorgan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-02T22:39:12.000Z","updated_at":"2024-04-11T11:10:58.000Z","dependencies_parsed_at":"2022-11-02T22:01:55.656Z","dependency_job_id":null,"html_url":"https://github.com/wapmorgan/Morphos-Twig","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FMorphos-Twig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FMorphos-Twig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FMorphos-Twig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wapmorgan%2FMorphos-Twig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wapmorgan","download_url":"https://codeload.github.com/wapmorgan/Morphos-Twig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245066496,"owners_count":20555402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["morphology","twig","twig-extension"],"created_at":"2024-10-11T06:54:28.131Z","updated_at":"2025-03-23T06:31:24.950Z","avatar_url":"https://github.com/wapmorgan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MorphosTwig\n\n[![Latest Stable Version](https://poser.pugx.org/wapmorgan/morphos-twig/version)](https://packagist.org/packages/wapmorgan/morphos-twig)\n[![License](https://poser.pugx.org/wapmorgan/morphos-twig/license)](https://packagist.org/packages/wapmorgan/morphos-twig)\n\nAdds {{ plural }}, {{ name }}, {{ numeral }}, {{ ordinal }} and {{ money }} filters to Twig templating engine for Russian pluralization and declenation.\n\n```twig\n\u003cdiv\u003e\n{{ 'новость'|plural(252) }} от {{ 'Иванов Иван Иванович'|name('родительный') }}\n{{ 'сообщение'|numeral(565, 'n') }} и {{ 123.50|money('₽') }} за Ваше отсутствие\nЭто Ваше {{ 351|ordinal('n') }} посещение нашего сайта за сегодня!\n\u003c/div\u003e\n```\n\nWill be compiled in\n\n```html\n\u003cdiv\u003e\n252 новости от Иванова Ивана Ивановича\nпятьсот шестьдесят пять сообщений и 123 рубля 50 копеек за Ваше отсутствие\nЭто Ваше триста пятьдесят первое посещение нашего сайта за сегодня!\n\u003c/div\u003e\n```\n\nMost popular filters:\n- `{{ $word|plural($count) }}` - Get plural form of word. Just pass count of objects and noun.\n    ```twig\n    {{ 'новость'|plural(251) }}\n    ```\n\n- `{{ $value|money($currency) }}` - Get money formatted as text string. Just pass value and currency (₽ or $ or € or ₴ or £).\n    ```twig\n    {{ 123.50|money('р') }}\n    ```\n\n- `{{ $number|numeral }}` - Get cardinal of a number. Just pass number.\n    ```twig\n    {{ 565|numeral }}\n    ```\n\n- `{{ $number|ordinal }}` - Get ordinal of a number. Just pass number.\n    ```twig\n    {{ 132|ordinal }}\n    ```\n\n- `{{ $name|name($case) }}` - Get any case of fullname with gender detection.\n    ```twig\n    {{ 'Иванов Иван Иванович'|name('родительный') }}\n    ```\n\nAdditional filters:\n- `{{ $name|name($gender, $case) }}` - Get any case of fullname. Just pass name, gender (`m` or `f` or null) and case (именительный, родительный, дательный, винительный, творительный, предложный).\n    ```twig\n    {{ 'Филимонов Игорь|name('m', 'дательный') }}\n    ```\n\n- `{{ $number|numeral($gender) }}` - Get numeral of a number. Just pass number and gender (`m` or `f` or `n`) to use correct form of gender-dependent words (один/одно/одна, два/две).\n    ```twig\n    {{ 565|numeral('n') }}\n    ```\n\n- `{{ $word|numeral($number) }}` - Get numeral with a pluralized word. Just pass number and noun.\n    ```twig\n    {{ 'дом'|numeral(221) }}\n    ```\n\n- `{{ $word|numeral($number, $gender) }}` - Get numeral with a pluralized word. Just pass number, noun and gender (`m` or `f` or `n`) to use correct form of gender-dependent words (один/одно/одна, два/две).\n    ```twig\n    {{ 'сообщение'|numeral(565, 'n') }}\n    ```\n\n- `{{ $number|ordinal($gender) }}` - Get ordinal of a number. Just pass number and gender (`m` or `f` or `n`) to use correct form of gender-dependent words (первый/первое/первая, второй/второе/вторая, etc).\n    ```twig\n    {{ 'сообщение'|ordinal('n') }}\n    ```\n\n\n\n## Installation\n\n### Get the Package\n\n```\ncomposer require wapmorgan/morphos-twig\n```\n\n### Register the Service\nOpen up your `services.php` in your `app/config` folder, and add the following lines:\n\n```php\n$container\n    -\u003eregister('morphos.twig_extension', morphos\\MorphosTwigExtension::class)\n    -\u003esetPublic(false)\n    -\u003eaddTag('twig.extension');\n```\n\nor if you using Twig separately from Symfony\n\n```php\n$twig = new Twig_Environment($loader);\n$twig-\u003eaddExtension(new morphos\\MorphosTwigExtension());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwapmorgan%2Fmorphos-twig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwapmorgan%2Fmorphos-twig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwapmorgan%2Fmorphos-twig/lists"}