Download the PHP package mroca/request-log-bundle without Composer

On this page you can find all versions of the php package mroca/request-log-bundle. 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 request-log-bundle

MrocaRequestLogBundle

An HTTP requests mock generator symfony bundle.

Build Status SensioLabsInsight

Description

This bundle allows to log HTTP requests and associated responses as json files. This generated json files can be used as API mock in order to test a front app without running the api.

How it works ?

After each request (Kernel::TERMINATE event) containing the x-generate-response-mock header, a json file is created containing the request and the response.

Examples :

GET /categories

app/log/mocks/categories/GET__.json

PUT /categories/1 {"foo": "bar"}

app/log/mocks/categories/PUT__1-a5e74.json

File naming strategy

All files are created with the following convention :

uri/METHOD__segments{--sorted-query=string&others}{__<sha1_substr5(sortedJsonContent)>}{__<sha1_substr5(sortedPostParameters)>}.json

Examples :

URL Filename
GET / GET__.json
GET /categories categories/GET__.json
GET /categories/1 categories/GET__1.json
GET /categories?search[category][]=foo categories/GET__--search%5Bcategory%5D%5B%5D=foo.json
GET /categories?order[foo]=asc&order[bar]=desc categories/GET__--order%5Bbar%5D=desc&order%5Bfoo%5D=asc.json
GET /categories?parent=/my/iri categories/GET__--parent=%2Fmy%2Firi.json
POST /categories PARAMS: foo1=bar1; foo2=bar2 categories/POST____3e038.json
POST /categories CONTENT: {"foo1":"bar1", "foo2":"bar2"} categories/POST____3e038.json
PUT /categories/1 CONTENT: {"foo2":"bar2", "foo1":"bar1"} categories/POST13e038.json
The filenames query strings can be hashed by setting the `hash_query_params` option to `true`.
For example, `categories/GET__--order[bar]=desc&order[foo]=asc.json` will be `categories/GET__--b0324.json`

The filenames query strings with non-asssocitive arrays are not indexed by default : `?foo[]=bar`.
You can use the indexed format by setting the `use_indexed_associative_array` option to `true` : `?foo[0]=bar`.

See the ResponseLoggerTest file for more examples.

Installation

You can use Composer to install the bundle to your project as a dev dependency :

Then, enable the bundle by updating your app/config/AppKernel.php file to enable the bundle:

If necessary, configure the bundle to your needs (example with default values):

If your are using the NelmioCorsBundle or another CORS protection, you must add the header in the allowed ones :

Usage

The request & response logger is not always activated. To log a request, add the x-generate-response-mock header into your request :

Commands

Some useful commands are available to manager your mocks :

Clear all mocks

Save mocks in a target directory

Dev

Php-cs-fixer

Testing

TODO


All versions of request-log-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
symfony/symfony Version ~2.3|~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 mroca/request-log-bundle contains the following files

Loading the files please wait ....