Install
Updated at:2025-10-16
Runtime environment
- Operating environment PHP SDK requires an operating environment of at least PHP 5.3.2.
-
Authentication To use the Baidu AI Cloud product, you need a Baidu AI Cloud account, a valid AK (Access Key ID) and SK (Secret Access Key) for signature certification.
Plain Text1 Your AK/SK information can be obtained and understood through the following steps: 2 1. [Register a Baidu AI Cloud account](https://login.bce.baidu.com/reg.html?tpl=bceplat&from=portal) 3 4 2. [Create AK/SK](https://console.bce.baidu.com/iam/?_=1513940574695#/iam/accesslist)
Install SDK
- Download the compressed Java SDK from the Official Website.
- After the ZIP package is decompressed, there are three files as follows:
Plain Text
1BaiduBce.phar //PHP SDK
2 BlbClient.php //Example
3 SampleConf.php //Reference configuration file, see specific content below
- Add the following code in the script file to use the SDK:
Plain Text
1include 'BaiduBce.phar';
2require 'YourConf.php';
For details on configuration files, refer to the "Configure BlbClient" section below.
SDK directory structure
Plain Text
1BaiduBce.phar
2├──src
3│ └── BaiduBce
4 │ ├── Auth //BCE signature
5 │ ├── Exception //BCE client exception
6 │ ├── Http //BCE HTTP communication
7 │ ├── Log //BCE log
8│ ├── Services
9 │ │ └── Blb //BLB main directory, which must be retained
10 │ │ ├── BlbClient.php //BLB operation class. All operations can be completed via BlbClient class
11│ │
12 │ └── Util //BCE common utilities
13 └──vendor //Third-party libraries
Uninstall SDK
To uninstall the SDK as expected, simply delete the phar package included in the script.
