openclerk/api-list

There is no license information available for the latest version (0.1.0) of this package.

A library for listing and discovering runtime properties of APIs

0.1.0 2017-09-11 07:29 UTC

This package is auto-updated.

Last update: 2024-04-14 08:19:48 UTC


README

A library for listing and discovering runtime properties of APIs

Installing

Include openclerk/api-list as a requirement in your project composer.json, and run composer update to install it into your project:

{
  "require": {
    "openclerk/api-list": "dev-master"
  }
}

Using

If you are using something like component-discovery, you can define a new API for listing all runtime discovered APIs using the ApiListApi abstract superclass:

class MyApiListApi extends \Apis\ApiList\ApiListApi {

  function getAPIs() {
    return \DiscoveredComponents\Apis::getAllInstances();
  }

}

You can also get all runtime API information like so:

$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
    // ...
  ));
}