PHPackages                             sukuangyun/aip - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sukuangyun/aip

ActiveLibrary

sukuangyun/aip
==============

v0.1.2(3y ago)018PHPPHP ^7.1|^8.0

Since Mar 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sukuangyun/aip)[ Packagist](https://packagist.org/packages/sukuangyun/aip)[ RSS](/packages/sukuangyun-aip/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

百度识图服务封装
--------

[](#百度识图服务封装)

### 安装

[](#安装)

```
composer require sukuangyun/aip

```

### 使用

[](#使用)

默认实现了文件缓存管理器来缓存accessToken，正常使用时请替换该缓存管理器，例如使用Redis等。 只需实现get()和set()方法即可。

```
$rds = new \Redis();
$rds->connect('127.0.0.1', 6379);
$rds->auth('password');
$cache = new \Sukuangyun\Aip\Cache\RedisCache($rds);
$aip = new \Sukuangyun\Aip\Aip(
    new \Sukuangyun\Aip\Config('appid', 'apikey', 'secretKey'),
    $cache
 );

// 在thinkphp中可以使用
// $aip = new Aip(new Config('appid', 'apikey', 'secretKey'), cache()->cache);
```

已封装的识图服务使用

```
