PHPackages                             openclerk/apis - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. openclerk/apis

ActiveLibrary[API Development](/categories/api)

openclerk/apis
==============

A library for defining and using APIs

0.1.0(8y ago)035016PHP

Since Sep 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/openclerk/apis)[ Packagist](https://packagist.org/packages/openclerk/apis)[ RSS](/packages/openclerk-apis/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (6)

openclerk/apis [![Build Status](https://camo.githubusercontent.com/915be430011c5bff3dce89ab71d57dbbc9ef495946cd9b553d4544e192acb8f5/68747470733a2f2f7472617669732d63692e6f72672f6f70656e636c65726b2f617069732e737667)](https://travis-ci.org/openclerk/apis)
============================================================================================================================================================================================================================================================

[](#openclerkapis-)

A library for defining APIs in Openclerk, live on [CryptFolio](https://cryptfolio.com/api).

Installing
----------

[](#installing)

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

```
{
  "require": {
    "openclerk/apis": "dev-master"
  }
}
```

Using
-----

[](#using)

Define subclasses of `\Apis\Api` to define endpoints and content:

```
/**
 * API to get a single currency properties.
 */
class Currency extends \Apis\Api {

  function getJSON($arguments) {
    $cur = \DiscoveredComponents\Currencies::getInstance($arguments['currency']);
    $result = array(
      'code' => $cur->getCode(),
      'title' => $cur->getName(),
    );

    return $result;
  }

  function getEndpoint() {
    return "/api/v1/currency/:currency";
  }

}
```

You can then call `$api->render()` for the specific API.

Using with magic
----------------

[](#using-with-magic)

Your APIs can be discovered with [component-discovery](https://github.com/soundasleep/component-discovery)by defining `apis.json`:

```
{
  "api/v1/currencies": "\\Core\\Api\\Currencies",
  "api/v1/currency/:currency": "\\Core\\Api\\Currency"
}
```

You can then load these into [openclerk/routing](https://github.com/openclerk/routing) at runtime:

```
// load up API routes
foreach (DiscoveredComponents\Apis::getAllInstances() as $uri => $handler) {
  \Openclerk\Router::addRoutes(array(
    $uri => $handler,
  ));
}
```

Caching
-------

[](#caching)

Using [openclerk/cache](https://github.com/openclerk/cache) you can also cache API calls:

```
/**
 * API to get a single currency properties.
 */
class Currency extends \Apis\CachedApi {

  // ...

  function getHash($arguments) {
    return substr($arguments['currency'], 0, 32);
  }

  function getAge() {
    return 60; /* cache age in seconds */
  }
}
```

TODO
----

[](#todo)

1. Documentation on Apis\\Fetch methods
2. A way to define APIs lazily without instantiating all Apis at every request time
3. Tests

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3170d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ebbec5ccc867054461adebb7c5b6312f8256f989ef96b124892e6e89724afdb?d=identicon)[soundasleep](/maintainers/soundasleep)

---

Top Contributors

[![soundasleep](https://avatars.githubusercontent.com/u/3889656?v=4)](https://github.com/soundasleep "soundasleep (27 commits)")

### Embed Badge

![Health badge](/badges/openclerk-apis/health.svg)

```
[![Health](https://phpackages.com/badges/openclerk-apis/health.svg)](https://phpackages.com/packages/openclerk-apis)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
