Download the PHP package ilrwebservices/campaign-monitor-rest-api-client without Composer

On this page you can find all versions of the php package ilrwebservices/campaign-monitor-rest-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 campaign-monitor-rest-api-client

Campaign Monitor REST API Client for PHP

A simple PHP http client for the Campaign Monitor REST API. Optimized for JSON and authentication via API key. Based on Guzzle.

CampaignMonitorRestClient is an extended GuzzleHttp\Client, so it can do all the things that Guzzle can and a bit more.

Be sure to refer to the Campaign Monitor API documentation for details.

Installation

Via composer:

Usage

Note how the API key is passed into the client constructor options along with other Guzzle-compatible options. In this example, the API key is stored in an environment variable since it is sensitive information that should not be stored in code.

The CampaignMonitorRestClient will set the base_uri option to https://api.createsend.com/api/v3.2/ automatically. To use a different base uri (for example for a different API version), you can specify it explicitly:

You can now make API calls just as you would in Guzzle:

Since the base_uri option is pre-configured, you can use a relative URL (be sure not to add a leading /, though):

And because it's Guzzle, there are shorthand methods:

Responses are PSR-7 response messages, just like Guzzle, so you can get returned data via getBody():

For application/json responses, CampaignMonitorRestClient adds a non-standard getData() method that decodes the JSON response for you:

Be careful with large responses, however, as they can consume too much memory.

Sending JSON data to API endpoints can be done using the json request option from Guzzle:

Error handling

You can use Guzzle exceptions for error handling. Campaign Montior endpoints generally use 4xx codes for errors, so GuzzleHttp\Exception\ClientException is a good match for catching those errors.

If the above request to create a new client failed, a GuzzleHttp\Exception\ClientException would be thrown and the following output displayed:

Inspired by drewm/mailchimp-api.


All versions of campaign-monitor-rest-api-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
ext-json Version *
guzzlehttp/guzzle Version >=6.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 ilrwebservices/campaign-monitor-rest-api-client contains the following files

Loading the files please wait ....