Persian tools for Symfony framework.
Add PersianToolsBundle in your composer.json
{
"require": {
"intuxicated/persian-tools-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command
$ php composer.phar update intuxicated/persian-tools-bundle
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Intuxicated\PersianToolsBundle\PersianToolsBundle(),
);
}
{{ '1364509205'|pdate }} {# result: 1392-01-09 #}
{{ '1364509205'|pdate('Y-m-d H:i:s') }} {# result: 1392-01-09 02:50:05 #}
{{ '123456789'|pnumber }} {# result: ۱۲۳۴۵۶۷۸۹ #}
{{ 'ملك عربي'|pletter }} {# result: 'ملک عربی'#}
DayOfYear return past days of the year
isKabise return true if year is intercalary
pnumber convert English/Arabic numbers to Persian numbers
pletter convert Arabic letters to Persian Letters
You can use all twig functions in controller. just simply load persian_tools
service :
$pt = $this->get('persian_tools');
// example
echo $pt->pnumber('123456');
https://github.com/intuxicated/sfPersianToolsBundle/blob/master/LICENSE