mucts / laravel-pinyin
Chinese to Pinyin translator.
1.2.3
2020-05-28 09:43 UTC
Requires
- php: ^7.4
- laravel/framework: ^7.0
- mucts/pinyin: >=1.0.3
Requires (Dev)
- phpunit/phpunit: ^8.0|^9.0
README
laravel-pinyin
Chinese to Pinyin translator for Laravel 7 based on mucts/pinyin.
Install
composer require mucts/laravel-pinyin
Usage
you can get the instance of MuCTS\Pinyin\Pinyin
from app container:
$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
Using facade:
use Pinyin; // Facade class, NOT MuCTS\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 mucts/pinyin
specific configuration and use, refer to: mucts/pinyin
License
MIT