PHPackages                             sw/pardot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. sw/pardot

ActiveLibrary[HTTP &amp; Networking](/categories/http)

sw/pardot
=========

A Pardot-API-Wrapper for PHP.

v1.0.5(8y ago)038MITPHPPHP &gt;=5.3.3

Since Oct 23Pushed 7y ago1 watchersCompare

[ Source](https://github.com/stefanwiebe/pardot)[ Packagist](https://packagist.org/packages/sw/pardot)[ Docs](https://github.com/stefanwiebe/pardot)[ RSS](/packages/sw-pardot/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (4)Versions (10)Used By (0)

This is a fork of [Henning Glatter-Götz' Pardot-API-Wrapper](https://github.com/hglattergotz/pardot) containing minor changes, for instance to allow the bulk-output-format.

Pardot
======

[](#pardot)

**Pardot** is an API connector for the [Pardot API](http://developer.pardot.com/kb/api-version-3/introduction-table-of-contents) implemented in PHP. It facilitates access to all the API endpoints that Pardot exposes. This can be used to build a custom CRM connector.

- Install via [Composer](http://getcomposer.org) package [hgg/pardot](https://packagist.org/packages/hgg/pardot)

Goals
-----

[](#goals)

- Provide a single method for executing any operation on any of the Pardot endpoints
- Parse the response and return only the data (PHP array from decoded JSON or a SimpleXmlElement)
- Take care of error handling

**NOTE** The XML format is not fully supported by this library. I do not use XML and do not have time to keep the XML parser up to date.

Dependencies
------------

[](#dependencies)

- [Guzzle](http://docs.guzzlephp.org/en/latest/#) - PHP HTTP Client
- [Collections](https://github.com/IcecaveStudios/collections) - A really nice implementation of common data structures
- [parameter-validator](https://github.com/hglattergotz/parameter-validator) - A parameter validator library

Conventions
-----------

[](#conventions)

The Pardot API should be accessed via POST for all operations (recommended by Pardot). For the most part the API does not use the standard HTTP response codes to convey the outcome of the request, rather it always returns 2\*\* response codes and sends back its own set of status codes that need to be handled. This connector captures the status codes and messages and throws exceptions that contain this information. If it should be necessary to handle the individual cases this is possible by catching the exception and extracting the error code from it.

All exceptions emitted by the library implement the ExceptionInterface. Any exceptions raised in the HTTP layer are wrapped into a RequestException.

See Error Handling for more details.

Usage
-----

[](#usage)

### Instantiating the Connector

[](#instantiating-the-connector)

The first argument to the constructor is an associative array containing the initialization parameters for the connector.

**Required**

- `email` - The email address of the user account
- `user-key` - The user key of the user account
- `password` - The account password

**Optional**

- `format` - The content format. Pardot supports json and xml. Default `json`
- `output` - The level of detail that is returned. Possible values are `full`, `simple`, `mobile`. Default `full`
- `api-key` - If the API key is being cached it can be injected into the constructor. Default `null`

The second parameter is optional and is an instance of the Guzzle\\Http\\Client. By default the Guzzle\\Http\\Client is instantiated with the exponential backoff plugin. It is configured for 5 retries (after 2, 4, 8, 16 and 32 seconds). If these settings are not desirable an instance of the client can be injected into the constructor with whatever settings/plugins are needed.

The third parameter is optional and is an array of options for the Guzzle Client post method. Default is array('timeout' =&gt; 10), which sets the timeout for the client to 10 seconds.

```
