ameen-sarsour / ar-php
ar-php 库的克隆版本
1.0.3
2021-10-05 19:30 UTC
Requires
- php: >=5.4.0
- ext-simplexml: *
This package is not auto-updated.
Last update: 2024-10-02 08:58:53 UTC
README
此库是从 ar-php 克隆的,它是一个强大的库,用于支持 PHP 中的阿拉伯语。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令
composer require ameen-sarsour/ar-php
用法
示例:将希吉拉字符串转换为时间戳
use \ArPhp\Arabic;
$time = time();
$Arabic = new Arabic('StrToTime');
$str = '1 رمضان 1439';
$int = $Arabic->strtotime($str, $time);
$date = date('l dS F Y', $int);
echo "String: $str \n";
echo "TimeStamp: $int \n";
echo "Date: $date \n";
##Yii2
相同示例
要使用此扩展,只需在您的应用程序配置中添加以下代码
return [ //.... 'components' => [ 'strToTime'=>[ 'class' => \ArPhp\Arabic::class, 'library' => '{{name of library eg. strToTime}}' ], ], ];
然后您可以调用以下函数
$str = '1 رمضان 1439'; $int = \Yii::$app->strToTime->strtotime($str, $time); $date = date('l dS F Y', $int); echo "String: $str \n"; echo "TimeStamp: $int \n"; echo "Date: $date \n"; echo $message . "\n";
ArPHP 全功能
ArPHP 官方网站
有关完整文档,请访问 ar-php
许可协议
GNU Lesser General Public License v3.0