PHP code example of jourdon / slug

1. Go to this page and download the library: Download jourdon/slug 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/ */

    

jourdon / slug example snippets



return [
    //翻译类型只有两种 "baidu", "youdao"

    'type'  =>  env('TRANSLATE_TYPE','baidu'),

    //翻译 API 地址
    'api' => [
        'baidu' =>  'http://api.fanyi.baidu.com/api/trans/vip/translate?',
        'youdao'=>  'https://openapi.youdao.com/api?'
    ],

    //App id 
    'translate_appid' => env('TRANSLATE_APPID',''),

    //APP secret 
    'translate_secret'   => env('TRANSLATE_SECRET',''),
];

TRANSLATE_TYPE= baidu
TRANSLATE_APPID=
TRANSLATE_SECRET=

\Jourdon\Slug\SlugServiceProvider::class,

use Slug;

Slug::translate('php是世界上最好的语言');
//php-is-the-best-language-in-the-world

bash
php artisan vendor:publish --provider="Jourdon\Slug\SlugServiceProvider"