1. Go to this page and download the library: Download jundayw/pinyin 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/ */
jundayw / pinyin example snippets
use Jundayw\PinYin\PinYin;
$config = yin->name('单某某');
use Jundayw\PinYin\Facades\Alphabet;
use Jundayw\PinYin\PinYin;
// 门面使用方法
Alphabet::name('单某某', PinYin::PINYIN_NAME);
// 依赖注入
public function test(PinYin $pinyin) {
return $pinyin->name('单某某');
}
use Jundayw\PinYin\Services\Alphabet;
use Jundayw\PinYin\PinYin;
// 门面使用方法
Alphabet::name('单某某', PinYin::PINYIN_NAME);
// 依赖注入
public function test(PinYin $pinyin) {
return $pinyin->name('单某某');
}
$pinyin->sentence('带着希望去旅行,比到达终点更美好!');
// dai zhe xi wang qu lyu xing, bi dao da zhong dian geng mei hao!
$pinyin->sentence('带着希望去旅行,比到达终点更美好!', null, PinYin::PINYIN_TONE);
// dài zhe xī wàng qù lǚ xíng, bǐ dào dá zhōng diǎn gèng měi hǎo!