History Plugin

The HistoryPlugin notifies a Http\Client\Common\Plugin\Journal of all successful and failed calls:

use Http\Discovery\HttpClientDiscovery;
use Http\Client\Common\PluginClient;
use Http\Client\Common\Plugin\HistoryPlugin;

$historyPlugin = new HistoryPlugin(new \My\Journal\Implementation());

$pluginClient = new PluginClient(
    HttpClientDiscovery::find(),
    [$historyPlugin]
);

As an example, HttplugBundle uses this plugin to collect responses and exceptions associated with requests for the debug toolbar.

This plugin only collects data after resolution. For logging purposes, it is recommended to use the LoggerPlugin instead, which logs events as they occur.