PHP code example of smmoosavi / twig-intl

1. Go to this page and download the library: Download smmoosavi/twig-intl 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/ */

    

smmoosavi / twig-intl example snippets


$twig->addExtension(new \smmoosavi\util\twigintl\Extension_Intl('fa_IR', 'persian')); // use your locale and calendar

 // test.php
twig
$loader = new Twig_Loader_String();
$twig = new Twig_Environment($loader);


// initializing twig-php-gettext
$twig->addExtension(new \smmoosavi\util\twigintl\Extension_Intl('fa_IR', 'persian'));

// using of twig-php-gettext
$test_date = new DateTime();
echo $twig->render("{{ lDateTime(test_date) }}", array('test_date' => $test_date));

bash
$ php composer.phar install