Download the PHP package lightools/bitbang-http-logger without Composer

On this page you can find all versions of the php package lightools/bitbang-http-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bitbang-http-logger

Introduction

This library allows you to log all HTTP traffic performed via clients in bitbang/http library.

Installation

Basic usage

Logging

Example above will log into file (contents shown below). You can see that request and response are in the same file and some timestamps are included above both HTTP messages. This behavior is done by and you can easily change it by implementing own (you may want to save HTTP request and response separately, change the file naming or store logs in database). DefaultWriter also saves whole HTTP communication when some redirect occurs - all subsequent HTTP requests will be stored in one file.

Formatting

By default, HTTP body is printed to log as it was set to Request or Response object, but you can register formatters to make it prettier and more readable. All you need is to implement interface and register it in logger. This library is shipped with few handy formatters - for array (typical POST), JSON, XML or for urlencoded HTTP body. ArrayFormatter also supports quite common CURLFile.

The first formatter that is able to format HTTP message is used, so theoretically it may matter in which order you register them. Here is example how to use all default formatters:

Limitations

Logged HTTP headers may not contain all really sent headers because some of them might be modified by proxies or even by curl library itself (e.g. very handy CURLOPT_ENCODING).

Multiple HTTP clients

If you are using bitbang clients in more services (for example lightools/fio and lightools/ares), and you don't want to store all logs in the same folder, custom IWriter or some HttpLoggerFactory and HttpClientFactory might be handy.

How to run tests


All versions of bitbang-http-logger with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
bitbang/http Version ~0.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lightools/bitbang-http-logger contains the following files

Loading the files please wait ....