Download the PHP package pipelinersales/pipeliner-api-client without Composer

On this page you can find all versions of the php package pipelinersales/pipeliner-api-client. 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 pipeliner-api-client

Pipeliner API client library for PHP

Introduction

This library serves as a convenient wrapper around Pipeliner's REST API. You can also view the API documentation for the individual classes.

Installing

The recommended way to install this library is via composer. Add "pipelinersales/pipeliner-api-client": "~1.0" to your dependencies in composer.json.

An alternative way is to manually download the sources and include the manual/pipeliner.php file. This will use a bundled autoloader to load all the library's classes.

The library requires PHP >= 5.3 with the cURL extension.

Basic usage

Creating the client object

The API client object is created like this

The API token and password for a particular pipeline can be found in the Sales Pipeline → API Access section of customer portal.

The create method sends a HTTP request in order to obtain the existing entity types.

Loading data

All data can be retrieved by either directly supplying the requested item's ID (the getById method), or by making a query with the get method.

For queries with no explicitly specified limit, up to 25 items will be returned.

The getById method returns an Entity object. See the Working with entities section to read about how to work with these objects. The get method returns an EntityCollection object, which can be accessed like a regular PHP array.

The library throws a PipelinerClientException or one of its subclasses on errors. For more information, see the Error handling section of this document.

Types of data in the system

The types of entities that the system consists of depend on the version of the pipeline that's being worked with. Versions 9 to 15 are supported by the current version of the library. The version of the pipeline can be obtained by calling $pipeliner->getPipelineVersion().

The list of entities along with their descriptions can be found in the API documentation at http://workspace.pipelinersales.com/community/api/

A full list can also be obtained in code, by calling the $pipeliner->getEntityTypes()

In code, entities are obtained by using repositories available as properties of the client object. Name of such a property is usually the plural of the entity name in camel case, so entities of type Account can be accessed via $pipeliner->accounts, etc. You can also obtain the repository with the getRepository method.

There are a few exceptions to this camel case plural rule. The full list of available repositories can be seen in the Magic properties summary in the PipelinerClient class documentation.

Querying

The criteria for which items should be retrieved consist of properties described in the server API docs Building the query strings manually is a hassle. The library offers several convenience classes to make it easier and your code more readable. These are available in the PipelinerSales\ApiClient\Query namespace.

You can specify the query criteria in one of several ways. Full list is available in the get method documentation.

Working with entities

Entities are represented by the Entity class. Their fields can be accessed in several ways:

The magic getters/setters are generally the preferred way of accessing fields. Custom fields should be set with the getField/setField methods

In addition to strings and numbers, all of these methods will automatically convert DateTime objects into a format expected by the server. The date/time will also be converted to UTC if it isn't already.

Modifying and saving data

After setting some of an entity's fields, the entity must be saved to the server with the save method on the proper repository object.

By default, only fields which have been modified in the code will be sent to the server. This behavior can be changed with the second argument of the save method. After a successful save, all fields will be reset to not modified.

If you have an entity object that you don't know the type of, you can obtain the proper repository by calling $pipeliner->getRepository($entity).

Creating new entities

New entities are created with a repository's create method. Just like with modifying data, they will not be sent to the server until the save method is called.

After a successful save, the ID field of the entity object will be set to the new entity's ID. You can also create entities by simply providing an associative array with all the fields and values.

In case of success, the returned response will be a CreatedResponse object. The id of the new entity can be obtained by calling the getCreatedId method of this object.

Deleting entities

Using collections

When loading multiple entities at once using the get method, its return value will be a EntityCollection object. For most purposes, it works like a regular PHP array (it extends PHP's ArrayObject class), but compared to arrays, it contains some extra information about the query.

One important difference is that EntityCollection objects are immutable (even though the elements inside them are themselves mutable).

If you need a mutable array, you can obtain a copy of the collection's underlying array with the getArrayCopy method.

Full range iterators

When loading multiple entities, Pipeliner's REST API allows you to limit the retrieved data to only parts of the results by specifying the limit and offset query parameters.

The EntityCollectionIterator class provides a convenient way of iterating through the entire range of matching results (without the limit) while only having a part of the data available at a time.

Initially, the iterator starts at the offset that was used in the request that returned the EntityCollection.

This class implements the SeekableIterator interface, which allows you to arbitrarily move through the result set. Data will be fetched from the server as needed. Currently loaded data is thrown away when new data is loaded, so it is a good idea to use this class in a way that minimizes the number of issued HTTP requests.

Error handling

The library uses exceptions for error handling. The base exception type it uses is PipelinerClientException, the other types inherit it.

In case of an error response from the server, a PipelinerHttpException is thrown. If the response contained error information from the server, it can be read using the getErrorMessage and getErrorCode methods. This information will also be part of the standard exception message.


All versions of pipeliner-api-client with dependencies

PHP Build Version
Package Version
Requires php Version >=5.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 pipelinersales/pipeliner-api-client contains the following files

Loading the files please wait ....