Download the PHP package 2ur1st/emarsys without Composer

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

Emarsys, PHP HTTP client for Emarsys webservice

Emarsys is a PHP HTTP client based on the official Emarsys web service documentation.

At the time of writing, only methods related to contacts are production ready.

All the other methods have been implemented following the documentation but not yet tested.

Installing via Composer

The recommended way to install Emarsys is through Composer.

After installing, you need to require Composer's autoloader:

Basics

To use the client, you need to instantiate a new one with your credentials. You also need to create an HTTP client and inject it into Emarsys Client. Snowcap/Emarsys is shipped with cURL HTTP client but it can be replaced with any other custom implementation.

At this point, you have access to all the methods implemented by the Emarsys API

For example :

Custom field mapping

As explained in the Emarsys documentation, each field is referenced by an ID.

You can do a $response = $client->getFields(); to get the complete list with their ids and names.

But dealing with IDs is not always the easiest way to work.

So, extra methods have been implemented to handle custom mapping.

First of all, a default (non-exhaustive) mapping has been set for the Emarsys pre-defined fields. You can find it in src/Snowcap/Emarsys/ini/fields.ini

But you can add your own by calling :

In that way, the default mapping and your own are merged and become available instantly as a replacement of these boring IDs.

It means that you can use both IDs and custom names to reference fields, so the two samples below do the same :

You also have access to additional methods to retrieve a particular ID by name and vice versa.

Last but not least, you can completely override the default mappings by passing an array as the third argument of the constructor.

You just have to refer to the official Emarsys documentation or the getFields() method to identify the right IDs.

Custom field choice mapping

When we use choice fields, each choice has its own ID, like a field.

You can do a $response = $client->getFieldChoices(5); to get the complete list of choices with their ids and names for a specific field (the gender for instance [5]).

But dealing with IDs is still not the easiest way to work.

So, extra methods have been implemented to handle custom mapping.

First of all, a default (non-exhaustive) mapping has been set for the Emarsys pre-defined field choices. You can find it in src/Snowcap/Emarsys/ini/choices.ini

But you can add your own by calling :

It means that you can use both IDs and custom names to reference field choices, so the two samples below do the same :

You also have access to additional methods to retrieve a particular ID by name and vice versa.

You can of course override completely the default mappings by passing an array as the fourth argument of the constructor.

You just have to refer to the official Emarsys documentation or the getFieldChoices() method to identify the right IDs.

The response

Almost every methods implementing the API return a new Response object.

This response is a simple class with three properties :

This matches the json response sent by the Emarsys API.

The reply code and reply text are the official reply returned by the Emarsys API. The data become an associative array representing the actual data (read the official Emarsys documentation, check the inline documentation in the code or var_dump the response)

Exceptions

The client throws 2 types of exceptions

The ServerException is carrying the original reply text and reply code sent by the API.

Some of the reply codes have already been handled as constants, but not all.

This could be very useful, for example : we could check the exception code to see if the contact was not found, then we could create it.


All versions of emarsys with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
lib-curl Version *
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 2ur1st/emarsys contains the following files

Loading the files please wait ....