swiftyper/swiftyper-php
最新稳定版本:v1.1.2
Composer 安装命令:
composer require swiftyper/swiftyper-php
包简介
swiftyper PHP Library
关键字:
README 文档
README
Documentation
swiftyper-php API documentation for PHP.
Requirements
PHP 5.6.0+.
Composer
You can install the bindings via Composer. Run the following command:
composer require swiftyper/swiftyper-php
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Manual installation
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.
require_once('/path/to/swiftyper-php/init.php');
Usage
Before you start using it, you need to set the API key which you can manage through your user account.
API keys are unlimited by default. Unlimited keys are not safe because they can be used by anyone and from anywhere. For production applications, we recommend setting API key restrictions as they help prevent unauthorized use and exhaustion of quotas. Restrictions determine which websites or IP addresses can use the API key.
\Swiftyper\Swiftyper::setApiKey('API_KEY_OF_SWIFTYPER_BUSINESS'); $results = \Swiftyper\Business::query([ 'query' => 'Google Slovakia', 'country' => 'SK', ]); var_dump($results->toArray());
Accessing the Response of a Request
You can get the data from the API response on any object through the getLastResponse() method.
$business = \Swiftyper\Business::detail('sk_WbilvhDEDokFTWk0FbNjeQ'); var_dump($business->getLastResponse());
Configuring Automatic Retries
It is possible to configure the library to retry a certain number of times in case of a request failure. This is useful when you want to make sure that a request is successfully processed even in case of a network failure.
\Swiftyper\Swiftyper::setMaxNetworkRetries(2);
统计信息
- 总下载量: 1.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-15