Skip to content

Laravel Package for translate string to english, then use it to create a slug

License

Notifications You must be signed in to change notification settings

jiemoon/chinese-slug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chinese-slug

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Laravel Package for translate string to english, then use it to create a slug.

Structure

If any of the following are applicable to your project, then the directory structure should follow industry best practises by being named the following..

src/
tests/

Install

Via Composer

$ composer require jiemoon/chinese-slug

Usage

Modify .env, Add Biadu Fanyi Config.

You can get the config, after register an account in api.fanyi.baidu.com

BAIDU_FANYI_API_ID=xxx
BAIDU_FANYI_API_SECRET=xxx

Edit cofig/app.php Add Provider and Alias

        Jiemoon\ChineseSlug\ChineseSlugServiceProvider::class,
        ...
        'ChineseSlug' => Jiemoon\ChineseSlug\Facades\ChineseSlug::class,
$slug = \ChineseSlug::generateUniqueSlug($title, 'posts');
# or
$slug = app('chineseslug')->generateUniqueSlug($title, 'posts');

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ phpunit

License

The MIT License (MIT). Please see License File for more information.

About

Laravel Package for translate string to english, then use it to create a slug

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages