jawira/case-converter-twig

🔤 Twig extension for Case Converter

v1.0.1 2022-10-10 19:58 UTC

This package is auto-updated.

Last update: 2024-10-11 00:24:13 UTC


README

This Twig extension is port from jawira/case-converter.

Latest Stable Version Total Downloads composer.lock .gitattributes License

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 GitHub stars
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 GitHub stars
Get access to +3000 emojis as class constants.
more...