{"id":17922723,"url":"https://github.com/overtrue/laravel-pinyin","last_synced_at":"2025-05-15T12:05:10.824Z","repository":{"id":28724796,"uuid":"32245936","full_name":"overtrue/laravel-pinyin","owner":"overtrue","description":":cn: Chinese to Pinyin translator for Laravel 5 / Lumen","archived":false,"fork":false,"pushed_at":"2025-02-25T14:25:28.000Z","size":41,"stargazers_count":528,"open_issues_count":1,"forks_count":61,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-21T19:01:48.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/overtrue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["overtrue"]}},"created_at":"2015-03-15T05:05:47.000Z","updated_at":"2025-02-25T14:24:53.000Z","dependencies_parsed_at":"2024-02-01T16:31:01.510Z","dependency_job_id":"e7fa40eb-4e67-401c-a373-357625c484a0","html_url":"https://github.com/overtrue/laravel-pinyin","commit_stats":{"total_commits":42,"total_committers":6,"mean_commits":7.0,"dds":"0.11904761904761907","last_synced_commit":"e8f7df4d8c45e6c013bd76a1d58bdb79ab68a5dd"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-pinyin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-pinyin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-pinyin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-pinyin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/overtrue","download_url":"https://codeload.github.com/overtrue/laravel-pinyin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T20:40:36.198Z","updated_at":"2025-05-15T12:05:05.807Z","avatar_url":"https://github.com/overtrue.png","language":"PHP","funding_links":["https://github.com/sponsors/overtrue"],"categories":[],"sub_categories":[],"readme":"# Laravel-Pinyin\n\nChinese to Pinyin translator for Laravel5 / Lumen based on [overtrue/pinyin](https://github.com/overtrue/pinyin).\n\n[![Latest Stable Version](https://poser.pugx.org/overtrue/laravel-pinyin/v/stable.svg)](https://packagist.org/packages/overtrue/laravel-pinyin) [![Total Downloads](https://poser.pugx.org/overtrue/laravel-pinyin/downloads.svg)](https://packagist.org/packages/overtrue/laravel-pinyin) [![Latest Unstable Version](https://poser.pugx.org/overtrue/laravel-pinyin/v/unstable.svg)](https://packagist.org/packages/overtrue/laravel-pinyin) [![License](https://poser.pugx.org/overtrue/laravel-pinyin/license.svg)](https://packagist.org/packages/overtrue/laravel-pinyin)\n\n[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)\n\n## Install\n\n```shell\ncomposer require \"overtrue/laravel-pinyin:~4.0\"\n```\n\n## For Laravel\n\n(If you are using Laravel \u003e= 5.5, the auto-discovery feature will handle these two steps for you.)\n\nAdd the following line to the section `providers` of `config/app.php`:\n\n```php\n'providers' =\u003e [\n    //...\n    Overtrue\\LaravelPinyin\\ServiceProvider::class,\n],\n```\n\nas optional, you can use facade:\n\n```php\n\n'aliases' =\u003e [\n    //...\n    'Pinyin' =\u003e Overtrue\\LaravelPinyin\\Facades\\Pinyin::class,\n],\n```\n\n## For Lumen\n\nAdd the following line to `bootstrap/app.php` after `// $app-\u003ewithEloquent();`\n\n```php\n...\n// $app-\u003ewithEloquent();\n\n$app-\u003eregister(Overtrue\\LaravelPinyin\\ServiceProvider::class);\n...\n```\n\n## Usage\n\nyou can get the instance of `Overtrue\\Pinyin\\Pinyin` from app container:\n\n```php\n\n$pinyin = app('pinyin');\necho $pinyin-\u003esentence('带着希望去旅行，比到达终点更美好');\n// dài zhe xī wàng qù lǔ xíng, bǐ dào dá zhōng diǎn gèng měi hǎo\n```\n\nThere are more convenient functions:\n\n|  function      | method                                                |\n| -------------  | --------------------------------------------------- |\n| `pinyin()`     | `app('pinyin')-\u003econvert()`                              |\n| `pinyin_abbr()`     | `app('pinyin')-\u003eabbr()`                                        |\n| `pinyin_permalink` | `app('pinyin')-\u003epermalink()`                         |\n| `pinyin_sentence` | `app('pinyin')-\u003esentence()`                         |\n\n```php\nvar_dump(pinyin('带着希望去旅行，比到达终点更美好'));\n// [\"dai\", \"zhe\", \"xi\", \"wang\", \"qu\", \"lv\", \"xing\", \"bi\", \"dao\", \"da\", \"zhong\", \"dian\", \"geng\", \"mei\", \"hao\"]\n\nvar_dump(pinyin_abbr('带着希望去旅行'));\n// dzxwqlx\n...\n```\n\nUsing facade:\n\n```php\nuse Pinyin; // Facade class, NOT Overtrue\\Pinyin\\Pinyin\n\nvar_dump(Pinyin::convert('带着希望去旅行'));\n// [\"dai\", \"zhe\", \"xi\", \"wang\", \"qu\", \"lv\", \"xing\"]\n\necho Pinyin::sentence('带着希望去旅行，比到达终点更美好');\n// dài zhe xī wàng qù lǔ xíng, bǐ dào dá zhōng diǎn gèng měi hǎo\n\n```\n\nAbout `overtrue/pinyin` specific configuration and use, refer to: [overtrue/pinyin](https://github.com/overtrue/pinyin)\n\n## :heart: Sponsor me \n\n[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue)\n\n如果你喜欢我的项目并想支持它，[点击这里 :heart:](https://github.com/sponsors/overtrue)\n\n\n## Project supported by JetBrains\n\nMany thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.\n\n[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/overtrue)\n\n## PHP 扩展包开发\n\n\u003e 想知道如何从零开始构建 PHP 扩展包？\n\u003e\n\u003e 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Flaravel-pinyin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovertrue%2Flaravel-pinyin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Flaravel-pinyin/lists"}