silktide/capiture

A very simple interface to track API calls.

1.2.13 2019-10-29 15:48 UTC

This package is auto-updated.

Last update: 2024-01-29 03:24:37 UTC


README

CircleCI

A very simple interface to track API calls.

cAPIpture is used in various Silktide API client libraries with a simple goal of collecting data.

There is no implementation here but this data could be used for various purposes including billing, usage reporting etc.

Getting started

Install from composer

composer require silkitde/capiture

Trait usage

There is an optional trait which can make life slightly easier by setting up the scaffolding.

Don't forget to set your implementation through the setApiUsageTracker() method.

<?php 


use Silktide\Capiture\ApiUsageTracker;

class ApiClient
{
    use ApiUsageTracker;
    
    public function makeRequest()
    {
        $this->trackApiUsage('my-api','https://my.api.com/v1/exciting', true, ['additional' => 'optional-metrics']);
    }
}