NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class HistoryPlugin

Maintains a list of requests and responses sent using a request or client

  Guzzle\Plugin\History\HistoryPlugin implements Symfony\Component\EventDispatcher\EventSubscriberInterface, IteratorAggregate, Countable

Namespace: Guzzle\Plugin\History
Located at Guzzle/Plugin/History/HistoryPlugin.php

## Methods summary

- `public static` `getSubscribedEvents ( )`
- `public` `__toString ( )`

  Convert to a string that contains all request and response headers

- `public` `add ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response = null )`

  Add a request to the history

- `public` `setLimit ( int $limit )`

  Set the max number of requests to store

- `public` `getLimit ( )`

  Get the request limit

- `public` `getAll ( )`

  Get all of the raw transactions in the form of an array of associative arrays containing 'request' and 'response' keys.

- `public` `getIterator ( )`

  Get the requests in the history

- `public` `count ( )`

  Get the number of requests in the history

- `public` `getLastRequest ( )`

  Get the last request sent

- `public` `getLastResponse ( )`

  Get the last response in the history

- `public` `clear ( )`

  Clears the history

- `public` `onRequestSent ( Guzzle\Common\Event $event )`

## Methods detail

# `public static`
`getSubscribedEvents( )`
# `public string`
`__toString( )`

Convert to a string that contains all request and response headers

#### Returns

`string`
# `public `Guzzle\Plugin\History\HistoryPlugin``
`add( `Guzzle\Http\Message\RequestInterface` $request, `Guzzle\Http\Message\Response` $response = null )`

Add a request to the history

#### Parameters

$request
  ``Guzzle\Http\Message\RequestInterface``
  $request Request to add
$response
  ``Guzzle\Http\Message\Response``
  $response Response of the request

#### Returns

``Guzzle\Plugin\History\HistoryPlugin``
# `public `Guzzle\Plugin\History\HistoryPlugin``
`setLimit( integer $limit )`

Set the max number of requests to store

#### Parameters

$limit
  `integer`
  $limit Limit

#### Returns

``Guzzle\Plugin\History\HistoryPlugin``
# `public integer`
`getLimit( )`

Get the request limit

#### Returns

`integer`
# `public array`
`getAll( )`

Get all of the raw transactions in the form of an array of associative arrays containing 'request' and 'response' keys.

#### Returns

`array`
# `public `ArrayIterator``
`getIterator( )`

Get the requests in the history

#### Returns

``ArrayIterator``

#### Implementation of

`IteratorAggregate::getIterator()`
# `public integer`
`count( )`

Get the number of requests in the history

#### Returns

`integer`

#### Implementation of

`Countable::count()`
# `public `Guzzle\Http\Message\RequestInterface``
`getLastRequest( )`

Get the last request sent

#### Returns

``Guzzle\Http\Message\RequestInterface``
# `public `Guzzle\Http\Message\Response`|null`
`getLastResponse( )`

Get the last response in the history

#### Returns

``Guzzle\Http\Message\Response`|null`
# `public `Guzzle\Plugin\History\HistoryPlugin``
`clear( )`

Clears the history

#### Returns

``Guzzle\Plugin\History\HistoryPlugin``
# `public`
`onRequestSent( `Guzzle\Common\Event` $event )`

### Magic methods summary

## Properties summary

`protected integer` | $limit | # The maximum number of requests to maintain in the history
`protected array` | $transactions | # Requests and responses that have passed through the plugin