1. Go to this page and download the library: Download opilo/farsi 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/ */
opilo / farsi example snippets
use Opilo\Farsi\JalaliDate;
$dateTime = \DateTime::createFromFormat('Y-m-d', '2015-09-03');
$jalaliDate = JalaliDate::fromDateTime($dateTime);
print ($jalaliDate->format('D S M ماه سال X'));
use Opilo\Farsi\JalaliDate;
$jalaliDate = new JalaliDate(1394, 6, 12);
$dateTime = $jalaliDate->toDateTime();
print($dateTime->format('Y-m-d'));
use Opilo\Farsi\JalaliDate;
$jalaliDate = JalaliDate::fromFormat('Y/m/d', '1394/6/20');
print($jalaliDate->format('D، d M y'));
use Opilo\Farsi\NumberToStringConverter;
print NumberToStringConverter::toString(21034510);
'jalali' => ':attribute وارد شده تاریخ شمسی معتبری طبق فرمت :format نیست (مثال معتبر: :fa-sample).',
'jalali_after' => ':attribute وارد شده باید یک تاریخ شمسی معتبر بعد از :date باشد.',
'jalali_before' => ':attribute وارد شده باید یک تاریخ شمسی معتبر قبل از :date باشد.',
...
//the rest of Farsi translations for validation rules.
'attributes' => [
'birth_date' => 'تاریخ تولد',
...
//the rest of Farsi translations for attributes
],
...
array(1) {
["birth_date"]=>
array(3) {
[0]=>
string(140) "تاریخ تولد وارد شده تاریخ شمسی معتبری طبق فرمت Y/m/d نیست (مثال معتبر: ۱۳۹۴/۹/۱۳)."
[1]=>
string(113) "تاریخ تولد وارد شده باید یک تاریخ شمسی معتبر قبل از 1381/01/01 باشد."
[2]=>
string(113) "تاریخ تولد وارد شده باید یک تاریخ شمسی معتبر بعد از 1300/01/01 باشد."
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.