mucts/laravel-pinyin

Chinese to Pinyin translator.

1.2.3 2020-05-28 09:43 UTC

This package is auto-updated.

Last update: 2024-10-28 19:29:58 UTC


README

Build Status Code Intelligence Status Scrutinizer Code Quality Total Downloads Latest Stable Version License

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