silktide / capiture
A very simple interface to track API calls.
Installs: 15 928
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 6
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^7.1
README
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']); } }