Skip to content

A very simple interface to track API calls.

Notifications You must be signed in to change notification settings

silktide/capiture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cAPIpture

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']);
    }
}