previewtechs / http-access-logger
HTTP access logs saved to any storage provider.
v1.0
2017-04-16 23:27 UTC
Requires
- php: >=5.5.9
- ext-curl: *
- psr/http-message: ^1.0
- psr/log: ^1.0
- tomwalder/php-gds: ^3.0
Requires (Dev)
- mockery/mockery: ^0.9.9
- phpunit/phpunit: ^4.0
- squizlabs/php_codesniffer: ^2.0
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.
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