jawira / case-converter-twig
🔤 Twig extension for Case Converter
Installs: 3 653
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.3
- jawira/case-converter: ^3.4
- twig/twig: ^2.4 || ^3.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.14
- jawira/skeleton: ^2.16
- phpstan/phpstan: ^0.12.95
- phpunit/phpunit: ^9.5
- symfony/phpunit-bridge: ^4.4.9 || ^5.0.9 || ^6.0
README
This Twig extension is port from jawira/case-converter.
Usage
This library provides the following filters:
Use a to_*
filter to automatically change the
casing convention of a string:
{{ 'welcome-to-the-jungle'|to_camel }} {# outputs 'welcomeToTheJungle' #}
Optionally, you can call a from_*
filter to specify the casing convention of input string:
{{ 'user.first-name'|from_dot|to_upper }} {# outputs 'USER FIRST-NAME' #}
How to install
Install with Composer:
$ composer require jawira/case-converter-twig
If you are not using Symfony Flex, you also have to register the extension:
# config/packages/case_converter_twig.yaml services: jawira.case.converter.twig: class: \Jawira\CaseConverterTwig\CaseConverterExtension tags: [ 'twig.extension' ]
Contributing
If you liked this project, ⭐ star it on GitHub.
License
This library is licensed under the MIT license.
Packages from jawira
- jawira/case-converter
- Convert strings between 13 naming conventions: Snake case, Camel case, Pascal case, Kebab case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Sentence case, Title case and Dot notation.
- jawira/emoji-catalog
- Get access to +3000 emojis as class constants.
- more...