PHP code example of aoxiang / baidu-aip

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

    

aoxiang / baidu-aip example snippets




$config = [
      'use'          => 'default',
      'debug'        => true,
      'applications' => [
          'default' => [
              'app_id'     => 'your app id',
              'api_key'    => 'your api key',
              'secret_key' => 'your secret key',
          ],
          'your app' => [
              'app_id'     => 'your app id',
              'api_key'    => 'your api key',
              'secret_key' => 'your secret key',
          ],
      ]
  ];

$aip = new \Qbhy\BaiduAIP\BaiduAIP($config);

var_dump(json_encode($aip->image_censor->antiSpam('测试')));
var_dump(json_encode($aip->use('your app')->image_censor->antiSpam('测试')));