Download the PHP package preluigi/ontraport without Composer

On this page you can find all versions of the php package preluigi/ontraport. 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 ontraport

OntraportPHP

PHP Library for Ontraport REST API

Installation - Using Composer

in order to use the library you need to update your require config in composer.json like this

Simple overview and usage

First you need to instantiate a new Ontraport object instance with your AppId and Key credentials

Then you can access OP objects and their CRUD functions like this

Supported Ontraport Object Types

Currently the following Ontraport Object Types are supported:

You can access them using the already seen syntax

Object Types methods

Every Object Type has the following default methods

Changing the API version

By default the library uses the version 1 of the REST API (which is the only one available at this moment). You can change the version to fit your needs (???) by using the Ontraport\Ontraport->set_version method:

Changing the default endpoints

By default the library initializes the following endpoints:

You can change one or all of those endpoints by using the Ontraport\Ontraport->set_endpoint method:

Note that custom defined endpoints will not use the API version attribute to generate the called endpoint, so you need to pass the complete endpoint URI.

How the library works

Before you start diving into more advanced OntraportPHP usages I bet you want to see in detail how the library works. So here's the answer: The library itself is composed by a set of classes organized by that pattern:

class Ontraport --calls--> class Contacts which extends class Objects

at the moment the library supports only operations on Ontraport Object Types; base CRUD methods are defined in the Ontraport\Objects class which is extended by object specific classes like Contacts or Products. So when you call ->Contacts->read() on an Ontraport\Ontraport object you're simply receiving the results from the Ontraport\Contacts->read() method which is inherited from the Ontraport\Objects class. Behind the scenes is going on a dependency injection from the class Ontraport\Ontraport object to the called class (eg: Ontraport\Contacts), in fact here there are two working examples:

Extend the library

I suggest you to read the preceding section: How the library works to better understand the following instructions.

There are basically two ways to extend the library with you own classes:

1) By using a custom namespace (Recommended)

The Ontraport\Ontraport class exposes a method called set_namespace which you can use to modify the namespace of the called Object Type classes, I think is better have an example:

Using this approach you can override any Object Type class and define your own while mantain the $ontraport->ClassName clear and compact syntax.

2) By using dependency injection

This method works the same as the first mentioned but instead of changing the base namespace used for inclusion you've got to extend Object Type classes and use dependency injection to pass the Ontraport\Ontraport object to the class constructor. Example:


All versions of ontraport with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
phpunit/phpunit Version >=5.0.9
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 preluigi/ontraport contains the following files

Loading the files please wait ....