openclerk / api-list
此包最新版本(0.1.0)没有提供许可证信息。
用于列出和发现API运行时属性的库
0.1.0
2017-09-11 07:29 UTC
Requires
- openclerk/apis: ^0.1
- openclerk/config: ^0.1
Requires (Dev)
- soundasleep/component-tests: dev-master
Suggests
- openclerk/cache: For cacheable APIs
This package is auto-updated.
Last update: 2024-09-14 09:14:37 UTC
README
用于列出和发现API运行时属性的库
安装
在您的项目 composer.json
中将 openclerk/api-list
包作为依赖项,然后运行 composer update
以将其安装到您的项目中
{ "require": { "openclerk/api-list": "dev-master" } }
使用
如果您正在使用类似 component-discovery 的工具,您可以使用 ApiListApi 抽象基类来定义一个用于列出所有运行时发现的API的新API
class MyApiListApi extends \Apis\ApiList\ApiListApi { function getAPIs() { return \DiscoveredComponents\Apis::getAllInstances(); } }
您也可以这样获取所有运行时API信息
$lister = new \Apis\ApiList\ApiLister(); $apis = $lister->processAPIs(\DiscoveredComponents\Apis::getAllInstances()); foreach ($apis as $api) { print_r(array( $api['endpoint'], $api['title'], $api['description'], $api['params'], // array // ... )); }