PHP code example of strays / baidu-ai

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

    

strays / baidu-ai example snippets




use Strays\BaiDuAi\Factory;

$config = [
    'apiKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'secretKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'ssl' => false,
];

$app = Factory::language($config);

$result = $app->lexer->send('百度是一个伟大的公司');



use Strays\BaiDuAi\Factory;

$config = [
    'apiKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'secretKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'ssl' => false,
];

$app = Factory::review($config);

$result = $app->text->send('百度是一个伟大的公司');