websoftwares/access-log

Log PSR-7 http messages using a PSR-3 logger instance following apache2 access log format.

0.0.1 2015-05-25 09:02 UTC

This package is auto-updated.

Last update: 2024-04-15 02:47:45 UTC


README

#AccessLog (v0.0.*) Log PSR-7 http messages using a PSR-3 logger instance following apache2 access log format.

Build Status Scrutinizer Code Quality Code Coverage

Installing via Composer (recommended)

Install composer in your project:

curl -s http://getcomposer.org/installer | php

Create a composer.json file in your project root:

{
    "require": {
		"websoftwares/access-log": ~0.0.1"
    }
}

Install via composer

php composer.phar install

Usage

Basic usage of the Websoftwares\AccessLog\Log class.

use Websoftwares\AccessLog\LogFormatFactory;
use Websoftwares\AccessLog\Log;

// $logger instance of Psr\Log\LoggerInterface;
$format = (new LogFormatFactory)->commonLog();
$accessLog = new Log($logger, $format);

// $request instance of Psr\Http\Message\ServerRequestInterface
// $response instance of Psr\Http\Message\ResponseInterface

$accessLog($request, $response);

Changelog

  • v0.0.1: Initial import

Testing

In the tests folder u can find several tests.

License

The MIT License (MIT).