A unofficial PHP client for Quickmetrics (quickmetrics.io)
To install the client you will need to be using Composer in your project. To install it please see the docs.
Install the client using
composer require jlis/quickmetrics-php
// create the client
$client = new \Jlis\Quickmetrics\Client('quickmetrics api key');
// collect the event
$client->event('event.name', 1.0, 'dimension');
// send the event to Quickmetrics.io
$client->flush();
You can also initialize the client with other options:
$client = new \Jlis\Quickmetrics\Client('your api key', [
'url' => 'https://someotherurl.tld',
'max_batch_size' => 10,
'timeout' => 5,
'connect_timeout' => 2,
]);
There are the following options:
Option | Usage | Type | Default |
---|---|---|---|
url |
The Quickmetrics API endpoint | string | https://qckm.io/list |
max_batch_size |
Amount of collected events until a batch request is triggered without the need to call flush() |
int | 100 |
timeout |
Number describing the timeout of the request in seconds | int | 1 |
connect_timeout |
Number describing the number of seconds to wait while trying to connect to a server | int | 1 |
Please see CHANGELOG for more information what has changed recently.
Dependencies are managed through composer:
$ composer install
Tests can then be run via phpunit:
$ vendor/bin/phpunit
Big thanks to Billomat which let my develop this library during my work time.
The MIT License (MIT). Please see License File for more information.