1. Go to this page and download the library: Download tentwofour/twig library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tentwofour / twig example snippets
$ex = new EmailEncodingExtension()
$ex->filter('[email protected]');
// => f@example.com
$ex = new DiffExtension();
$old = 'That's what it said on "Ask Jeeves."';
$new = 'That's what it said on "Dogpile."';
// Output to array
$ex->diffHtml($old, $new, 'array');
// => [
// 'old' => 'That's what it said on <del>"Ask Jeeves."</del>',
// 'new' => 'That's what it said on <ins>"Dogpile."</ins>',
// ]
// Output to single string
$ex->diffHtml($old, $new, 'string');
// => 'That's what it said on <del>"Ask Jeeves."</del><ins>"Dogpile."</ins>';
$ex = new InflectorExtension();
$string = 'camelCaseWordWith1Number';
$ex->camelCaseToCapitalizedWords($string)
// => 'Camel Case Word With 1 Number'
$ex->camelCaseToSentenceCasedWords($string)
// => 'Camel case word with 1 number'
$ex->camelCaseToLowerCasedWords($string)
// => 'camel case word with 1 number'
$ex = new MoneyExtension();
$ex->centsToDollars(1200);
// => '12.00'