yproximite / yprox-api-client-bundle
为 Symfony 集成 yProx API 客户端库
v3.0.0
2020-11-03 12:05 UTC
Requires
- php: ^7.2
- symfony/framework-bundle: ^3.4 || ^4.0 || ^5.0
- yproximite/yprox-api-client: ^0.11.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpspec/phpspec: ^6.0
- phpstan/phpstan: ^0.12.53
- phpstan/phpstan-phpunit: ^0.12.16
- phpstan/phpstan-strict-rules: ^0.12.5
- symfony/phpunit-bridge: ^3.4 || ^4.0 || ^5.0
This package is auto-updated.
Last update: 2024-08-29 04:40:19 UTC
README
安装
将 yproximite/yprox-api-client-bundle 添加到您的 composer.json 文件中
$ composer require yproximite/yprox-api-client-bundle
在 app/AppKernel.php 中注册此包
// app/AppKernel.php public function registerBundles() { return [ // ... new Yproximite\Bundle\YproxApiClientBundle\YproxApiClientBundle(), ]; }
配置
以下为配置参考
# app/config/config.yml yprox_api_client: # Identifier of the service that represents "Http\Client\HttpClient" http_client: httplug.client.guzzle6 clients: # Simple example default: api_key: xxxxx # Advanced example custom: api_key: yyyyy base_url: http://api.host.com
使用方法
// yprox_api_client.service_aggregator.<client_name_from_config> $api = $this->get('yprox_api_client.service_aggregator.default'); $message = new ArticleListMessage(); $message->setSiteId(1); // Yproximite\Api\Model\Article\Article[] $articles = $api->article()->getArticles($message);