mhzarei / persian-tools-bundle
Persian Tools for Symfony 3 and 4
Installs: 113
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 5
pkg:composer/mhzarei/persian-tools-bundle
Requires
- php: >=5.3.3
- symfony/framework-bundle: ~3.0|~4.0
- twig/twig: >=1.5
This package is auto-updated.
Last update: 2025-10-29 02:50:26 UTC
README
Persian tools for Symfony framework.
Installation
Download PersianToolsBundle using composer
Add PersianToolsBundle in your composer.json
{
"require": {
"mhzarei/persian-tools-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command
$ php composer.phar update mhzarei/persian-tools-bundle
Enable the bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Intuxicated\PersianToolsBundle\PersianToolsBundle(), ); }
Twig Filters
{{ '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: 'ملک عربی'#}
Twig Functions
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
Controller Functions
You can use all twig functions in controller. just simply load persian_tools service :
$pt = $this->get('persian_tools'); // example echo $pt->pnumber('123456');
License
https://github.com/intuxicated/sfPersianToolsBundle/blob/master/LICENSE