PHP Classes

PHP Case Converter for Twig: Convert parameter values used in Twig templates

Recommend this page to a friend!
  Info   View files Documentation   View files View files (22)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 21 All time: 11,144 This week: 119Up
Version License PHP version Categories
case-converter-twig 1.0Custom (specified...5PHP 5, Text processing, Templates
Description 

Author

This package can convert parameter values used in Twig templates.

It provides an extension for the Twig template engine that comes with the Symfony framework.

This extension can convert the values of parameter values to be replaced in certain template placeholders.

It supports several types of parameter values conversion functions such as:

- ADA
- Camel
- Cobol
- Dot
- Kebab
- Lower
- Macro
- Pascal
- Sentence
- Snake
- Title
- Train
- Upper

Innovation Award
PHP Programming Innovation award nominee
June 2021
Number 6
Sometimes developers need to convert the case of words in a text string. There are many types of case conversion.

This package provides a solution to implement case conversions of many types for values to be used in the processing of templates using the Twig template engine.

Manuel Lemos
Picture of jawira
  Performance   Level  
Name: jawira <contact>
Classes: 11 packages by
Country: Belgium Belgium
Age: ???
All time rank: 302316 in Belgium Belgium
Week rank: 91 Up1 in Belgium Belgium Up
Innovation award
Innovation award
Nominee: 9x

Winner: 2x

Documentation

? Twig extension for Case Converter

This package is a Twig extension that provides the following filters:

  • `to_ada`
  • `to_camel`
  • `to_cobol`
  • `to_dot`
  • `to_kebab`
  • `to_lower`
  • `to_macro`
  • `to_pascal`
  • `to_sentence`
  • `to_snake`
  • `to_title`
  • `to_train`
  • `to_upper`

Latest Stable Version Total Downloads composer.lock .gitattributes License

Usage

{{ 'welcome-to-the-jungle'|to_camel }}

{# outputs 'welcomeToTheJungle' #}

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']

Documentation

<https://jawira.github.io/case-converter/>

Contributing

If you liked this project, ? star it on GitHub.

License

This library is licensed under the MIT license.

*

Packages from jawira

<dl>

<dt>

<a href="https://packagist.org/packages/jawira/case-converter">jawira/case-converter
<img alt="GitHub stars" src="https://badgen.net/github/stars/jawira/case-converter?icon=github"/></a>

</dt> <dd>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. </dd>

<dt>

<a href="https://packagist.org/packages/jawira/emoji-catalog">jawira/emoji-catalog
<img alt="GitHub stars" src="https://badgen.net/github/stars/jawira/emoji-catalog?icon=github"/></a>

</dt> <dd>Get access to +3000 emojis as class constants.</dd>

<dt><a href="https://packagist.org/packages/jawira/">more...</a></dt> </dl>


  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetests (1 file, 1 directory)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file build.svg Data Auxiliary data
Accessible without login Plain text file build.xml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file CaseConverterExtension.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageFixtures (13 files)
  Plain text file ExtensionTest.php Class Class source

  Files folder image Files  /  tests  /  Fixtures  
File Role Description
  Accessible without login Plain text file to_ada.test Data Auxiliary data
  Accessible without login Plain text file to_camel.test Data Auxiliary data
  Accessible without login Plain text file to_cobol.test Data Auxiliary data
  Accessible without login Plain text file to_dot.test Data Auxiliary data
  Accessible without login Plain text file to_kebab.test Data Auxiliary data
  Accessible without login Plain text file to_lower.test Data Auxiliary data
  Accessible without login Plain text file to_macro.test Data Auxiliary data
  Accessible without login Plain text file to_pascal.test Data Auxiliary data
  Accessible without login Plain text file to_sentence.test Data Auxiliary data
  Accessible without login Plain text file to_snake.test Data Auxiliary data
  Accessible without login Plain text file to_title.test Data Auxiliary data
  Accessible without login Plain text file to_train.test Data Auxiliary data
  Accessible without login Plain text file to_upper.test Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:21
This week:0
All time:11,144
This week:119Up