2017 © Pedro Peláez
 

library laravel-pinyin

Chinese to Pinyin translator.

image

overtrue/laravel-pinyin

Chinese to Pinyin translator.

  • Tuesday, July 4, 2017
  • by overtrue
  • Repository
  • 11 Watchers
  • 325 Stars
  • 54,460 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 33 Forks
  • 3 Open issues
  • 11 Versions
  • 12 % Grown

The README.md

Laravel-Pinyin

Chinese to Pinyin translator for Laravel5 / Lumen based on overtrue/pinyin., (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Sponsor me, (*3)

Install

composer 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.), (*4)

Add the following line to the section providers of config/app.php:, (*5)

'providers' => [
    //...
    Overtrue\LaravelPinyin\ServiceProvider::class,
],

as optional, you can use facade:, (*6)


'aliases' => [ //... 'Pinyin' => Overtrue\LaravelPinyin\Facades\Pinyin::class, ],

For Lumen

Add the following line to bootstrap/app.php after // $app->withEloquent();, (*7)

...
// $app->withEloquent();

$app->register(Overtrue\LaravelPinyin\ServiceProvider::class);
...

Usage

you can get the instance of Overtrue\Pinyin\Pinyin from app container:, (*8)


$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:, (*9)

function method
pinyin() app('pinyin')->convert()
pinyin_abbr() app('pinyin')->abbr()
pinyin_permalink app('pinyin')->permalink()
pinyin_sentence app('pinyin')->sentence()
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:, (*10)

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 overtrue/pinyin specific configuration and use, refer to: overtrue/pinyin, (*11)

:heart: Sponsor me

Sponsor me, (*12)

如果你喜欢我的项目并想支持它,点击这里 :heart:, (*13)

Project supported by JetBrains

Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects., (*14)

, (*15)

PHP 扩展包开发

想知道如何从零开始构建 PHP 扩展包?, (*16)

请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》, (*17)

License

MIT, (*18)

The Versions

04/07 2017

dev-master

9999999-dev

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

03/07 2017

3.0.5

3.0.5.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

29/01 2017

3.0.3

3.0.3.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

06/12 2016

dev-1.0.0-fix

dev-1.0.0-fix

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

12/06 2016

3.0.2

3.0.2.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

25/05 2016

3.0.1

3.0.1.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

22/04 2016

3.0.0

3.0.0.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

12/01 2016

1.2.1

1.2.1.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

19/03 2015

1.2.0

1.2.0.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

16/03 2015

1.1.0

1.1.0.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

laravel pinyin chinese overtrue

15/03 2015

1.0.0

1.0.0.0

Chinese to Pinyin translator.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue