previewtechs/http-access-logger

HTTP access logs saved to any storage provider.

v1.0 2017-04-16 23:27 UTC

This package is auto-updated.

Last update: 2024-12-06 09:05:57 UTC


README

Simple HTTP Access Logger

Simple but powerful HTTP access logger and usage monitoring. Mostly it will help to monitor API usage and anytime you can add your database storage to save all the usages.

Currently Google DataStore has been added as a Storage Provider. Everybody welcome to add more provider to it.

License Build Status Code Coverage Code Quality

Usage

Install with composer require previewtechs/http-access-logger

<?php
require "vendor/autoload.php";

//Setup your Google Datastore Gateway
$gateway = new \GDS\Gateway\RESTv1('my-google-cloud-project-name');
$dataStore = new \GDS\Store('my-kind-name', $gateway);

//Initialize storage provider
$storage = new \Previewtechs\HTTP\AccessLogger\Providers\GoogleDataStore($dataStore);

/**
 * Now start recording your HTTP access log by providign your storage provider and Psr/http-message ServerRequestInterface
 * compatible $request object
 */
$log = new \Previewtechs\HTTP\AccessLogger\AccessLog($request, $storage);
$log->record();

For bug and issues please open an issue.

Contribution

Keep it simple but we can add more and more Storage provider like (MySQL, MongoDB and other storage);

To build a new provider please see src/Providers/GoogleDataStore.php