light/apistore

百度API商品免费接口封装

0.1.5 2016-01-07 13:59 UTC

This package is auto-updated.

Last update: 2024-12-08 20:03:42 UTC


README

Build Status version Download Scrutinizer Code Quality Code Coverage Contact

百度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