PHP code example of overxue / slug

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

    

overxue / slug example snippets


'baidu' => [
      'appId' => env('BAIDU_APP_ID'),
      'appKey' => env('BAIDU_APP_KEY')
  ],


app('slug')->translate('如何翻译laravel文档');
// how-to-translate-laravel-documents
// 不配置秘钥和appid返回     ru-he-fan-yi-laravel-wen-dang

或者

use Overxue\Slug\Slug;

$slug = new Slug(config('services.baidu'));
$slug->translate('如何翻译laravel文档');
// how-to-translate-laravel-documents