apistore-基于百度提供的免费接口调用库

PHP · light · 于 7年前 发布 · 6350 次阅读

apistore

Build Status version Download Issues codecov.io

百度APIStore免费接口封装

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist light/apistore "*"

or add

"light/apistore": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

$store = new light\apistore\ApiStore('your key');
$api = $store->phone;

$result = $api->get('15292312331');

if ($result['errcode'] == 0) {
	var_dump($result['data']);
} else {
	echo 'Get error: ', $result['errmsg'];
}

目前可用接口:

如何添加新接口

如果你发现需要的接口目前没有,可以发起pull request进行提交.

流程是在src/apis建立新的接口调用类,新的接口需要继承自light\apistore\apis\Api, 大概如下:

class Sms extends Api
{
	private $address = 'http://apiurl';

	public function get($params)
	{
		return $this->fetch($this->address . http_build_query($params));
	}
}

License

MIT

欢迎star

https://github.com/lichunqiang/apistore

共收到 2 条回复
forecho#17年前 0 个赞

这个库确实不错,百度提供的这个 api store ,我早已经加入本站的酷站

forecho#27年前 0 个赞

扩展 GitHub 地址给补上吧

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册