开源软件名称(OpenSource Name):overtrue/laravel-pinyin开源软件地址(OpenSource Url):https://github.com/overtrue/laravel-pinyin开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):Laravel-PinyinChinese to Pinyin translator for Laravel5 / Lumen based on overtrue/pinyin. Installcomposer require "overtrue/laravel-pinyin:~4.0" For Laravel(If you are using Laravel >= 5.5, the auto-discovery feature will handle these two steps for you.) Add the following line to the section 'providers' => [
//...
Overtrue\LaravelPinyin\ServiceProvider::class,
], as optional, you can use facade: 'aliases' => [
//...
'Pinyin' => Overtrue\LaravelPinyin\Facades\Pinyin::class,
], For LumenAdd the following line to ...
// $app->withEloquent();
$app->register(Overtrue\LaravelPinyin\ServiceProvider::class);
... Usageyou can get the instance of $pinyin = app('pinyin');
echo $pinyin->sentence('带着希望去旅行,比到达终点更美好');
// dài zhe xī wàng qù lǔ xíng, bǐ dào dá zhōng diǎn gèng měi hǎo There are more convenient functions:
var_dump(pinyin('带着希望去旅行,比到达终点更美好'));
// ["dai", "zhe", "xi", "wang", "qu", "lv", "xing", "bi", "dao", "da", "zhong", "dian", "geng", "mei", "hao"]
var_dump(pinyin_abbr('带着希望去旅行'));
// dzxwqlx
... Using facade: use Pinyin; // Facade class, NOT Overtrue\Pinyin\Pinyin
var_dump(Pinyin::convert('带着希望去旅行'));
// ["dai", "zhe", "xi", "wang", "qu", "lv", "xing"]
echo Pinyin::sentence('带着希望去旅行,比到达终点更美好');
// dài zhe xī wàng qù lǔ xíng, bǐ dào dá zhōng diǎn gèng měi hǎo About
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论