gimler / guzzle-description-loader
从各种文件格式加载 guzzle 服务描述
v0.0.4
2016-01-27 06:35 UTC
Requires
- php: >=5.5.0
- symfony/config: ~3.0
- symfony/yaml: ~3.0
This package is not auto-updated.
Last update: 2024-09-14 17:37:23 UTC
README
Guzzle 服务描述加载器
一个独立的 Guzzle 5.x 服务描述加载器。
安装
如果您正在使用 Composer,您应该这样做,只需运行以下命令
composer require "gimler/guzzle-description-loader"
支持的文件格式
- Yaml
- Php
- Json
用法
use Guzzle\Service\Loader\JsonLoader; use GuzzleHttp\Command\Guzzle\Description; use Symfony\Component\Config\FileLocator; $configDirectories = array(DESCRIPTION_PATH); $this->locator = new FileLocator($configDirectories); $this->jsonLoader = new JsonLoader($this->locator); $description = $this->jsonLoader->load($this->locator->locate('description.json')); $description = new Description($description);
示例
{ "operations": { "certificates.list": { "httpMethod": "GET", "uri": "certificates", "description": "Lists and returns basic information about all of the management certificates associated with the specified subscription.", "responseModel": "CertificateList" } }, "models": { "CertificateList": { "type": "array", "name": "certificates", "sentAs": "SubscriptionCertificate", "location": "xml", "items": { "type": "object" } } }, "imports": [ "description_import.json" ] }