PHP Classes

PHP HTTP Request Logger: Store details about the HTTP request in a database

Recommend this page to a friend!
  Info   View files Documentation   View files View files (37)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 105 This week: 1All time: 9,696 This week: 560Up
Version License PHP version Categories
http-request-logger 1.0.0MIT/X Consortium ...5.6HTTP, PHP 5, Databases, Logging
Description 

Author

This package can store details about the HTTP request in a database.

It is a plugin for the Eliasis framework that can take details about each request and store them database table records.

The package stores in database table records details like the user computer IP address, request URI, HTTP or HTTPS protocol, request method, user agent, state and request load time.

Picture of Josantonius
  Performance   Level  
Name: Josantonius is available for providing paid consulting. Contact Josantonius .
Classes: 31 packages by
Country: Spain Spain
Age: ???
All time rank: 132526 in Spain Spain
Week rank: 27 Up3 in Spain Spain Up
Innovation award
Innovation award
Nominee: 11x

Documentation

HTTP Request Logger · Eliasis PHP Framework plugin

Packagist Downloads License Codacy Badge Build Status PSR2 PSR4 codecov

Versión en español

Save HTTP request information to the database.

Requirements

This plugin is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.

Installation

The preferred way to install this extension is through Composer.

To install HTTP Request Logger, simply:

$ composer require eliasis-framework/http-request-logger

The previous command will only install the necessary files, if you prefer to download the entire source code you can use:

$ composer require eliasis-framework/http-request-logger --prefer-source

You can also clone the complete repository with Git:

$ git clone https://github.com/eliasis-framework/http-request-logger.git

Usage

To use this plugin, your Eliasis application must use the PHP-Database library and add the following to the application configuration files:

/
 * eliasis-app/config/complements.php
 */
return [

    'plugin' => [

        'http-request-logger' => [

            'db-id' => 'app',
            'db-prefix' => 'test_',
            'db-charset' => 'utf8',
            'db-engine' => 'innodb'
        ],
    ],
];

This will create the test_request table and automatically save all HTTP requests.

The table structure created is as follows:

| request_id | request_ip | request_uri | request_protocol | request_method | request_referer | request_user_agent | request_http_state | request_load_time | created | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | 1 | 87.142.85.70 | /sample-app/ | HTTP/1.1 | GET | http://www.google.es/ | Mozilla/5.0 (...) | 200 | 0.008 | 2018-02-28 08:26:43 |

Tests

To run tests you just need composer and to execute the following:

$ git clone https://github.com/eliasis-framework/http-request-logger.git

$ cd http-request-logger

$ composer install

Run unit tests with PHPUnit:

$ composer phpunit

Run PSR2 code standard tests with PHPCS:

$ composer phpcs

Run PHP Mess Detector tests to detect inconsistencies in code style:

$ composer phpmd

Run all previous tests:

$ composer tests

? TODO

  • [ ] Add getter methods.
  • [ ] Add new feature.
  • [ ] Improve tests.
  • [ ] Improve documentation.
  • [ ] Refactor code for disabled code style rules. See phpmd.xml and .php_cs.dist.

Contribute

If you would like to help, please take a look at the list of issues or the To Do checklist.

Pull requests

  • Fork and clone.
  • Run the command `composer install` to install the dependencies. This will also install the dev dependencies.
  • Run the command `composer fix` to excute code standard fixers.
  • Run the tests.
  • Create a branch, commit, push and send me a pull request.

License

This project is licensed under MIT license. See the LICENSE file for more info.

Copyright

2017 - 2018 Josantonius, josantonius.com

If you find it useful, let me know :wink:

You can contact me on Twitter or through my email.


  Files folder image Files  
File Role Description
Files folder imageconfig (5 files)
Files folder imagesrc (2 directories)
Files folder imagetests (2 files, 1 directory)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .php_cs.dist Example Example script
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONDUCT.md Data Auxiliary data
Accessible without login Plain text file http-request-logger.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpcs.xml Data Auxiliary data
Accessible without login Plain text file phpmd.xml Data Auxiliary data
Accessible without login Plain text file README-ES.md Doc. Documentation
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file _config.yml Data Auxiliary data

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file database.php Aux. Auxiliary script
  Accessible without login Plain text file namespaces.php Aux. Auxiliary script
  Accessible without login Plain text file server.php Aux. Auxiliary script
  Accessible without login Plain text file set-hooks.php Example Example script
  Accessible without login Plain text file tables.php Aux. Auxiliary script

  Files folder image Files  /  src  
File Role Description
Files folder imageController (2 files, 1 directory)
Files folder imageModel (1 file)

  Files folder image Files  /  src  /  Controller  
File Role Description
Files folder imageException (1 file)
  Plain text file Launcher.php Class Class source
  Plain text file Request.php Class Class source

  Files folder image Files  /  src  /  Controller  /  Exception  
File Role Description
  Plain text file RequestException.php Class Class source

  Files folder image Files  /  src  /  Model  
File Role Description
  Plain text file Request.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imagesample-app (2 directories)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file PluginTest.php Class Class source

  Files folder image Files  /  tests  /  sample-app  
File Role Description
Files folder imageconfig (2 files)
Files folder imageplugins (1 file, 1 directory)

  Files folder image Files  /  tests  /  sample-app  /  config  
File Role Description
  Accessible without login Plain text file complements.php Aux. Auxiliary script
  Accessible without login Plain text file database.php Aux. Auxiliary script

  Files folder image Files  /  tests  /  sample-app  /  plugins  
File Role Description
Files folder imagehttp-request-logger (1 file, 2 directories)
  Accessible without login Plain text file .plugins-states.json Data Auxiliary data

  Files folder image Files  /  tests  /  sample-app  /  plugins  /  http-request-logger  
File Role Description
Files folder imageconfig (5 files)
Files folder imagesrc (2 directories)
  Accessible without login Plain text file http-request-logger.json Data Auxiliary data

  Files folder image Files  /  tests  /  sample-app  /  plugins  /  http-request-logger  /  config  
File Role Description
  Accessible without login Plain text file database.php Aux. Auxiliary script
  Accessible without login Plain text file namespaces.php Aux. Auxiliary script
  Accessible without login Plain text file server.php Aux. Auxiliary script
  Accessible without login Plain text file set-hooks.php Example Example script
  Accessible without login Plain text file tables.php Aux. Auxiliary script

  Files folder image Files  /  tests  /  sample-app  /  plugins  /  http-request-logger  /  src  
File Role Description
Files folder imageController (2 files, 1 directory)
Files folder imageModel (1 file)

  Files folder image Files  /  tests  /  sample-app  /  plugins  /  http-request-logger  /  src  /  Controller  
File Role Description
Files folder imageException (1 file)
  Plain text file Launcher.php Class Class source
  Plain text file Request.php Class Class source

  Files folder image Files  /  tests  /  sample-app  /  plugins  /  http-request-logger  /  src  /  Controller  /  Exception  
File Role Description
  Plain text file RequestException.php Class Class source

  Files folder image Files  /  tests  /  sample-app  /  plugins  /  http-request-logger  /  src  /  Model  
File Role Description
  Plain text file Request.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:105
This week:1
All time:9,696
This week:560Up