Download the PHP package getanewsletter/api-php without Composer

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

API-PHP

The API-PHP library presents a simple and easy to use interface to the Get a Newsletter's REST API.

Requirements

Installation

If your project is supporting Composer you may use the following in your composer.json file:

Usage

Start by creating an instance of the object:

Here variable must contain a valid API token string.

The contact object

The instances of the \Gan\Contact class represent the contact entities in the API. They have the following fields:

Required fields

Optional fields

Read-only fields

Retreiving a contact

You have to create an instance of the class and then use it's method to retrieve the contact you need.

The manager methods will throw an in case of HTTP error from the API, so it's a good idea to catch it.

Creating a contact

This will create a new contact and save it. Again, it'll be a good idea to catch exceptions when calling the method. The API will respond with an error if the contact already exists. One way to avoid it is to force the creation of the contact, overwriting the existing one:

Both and will return the same contact object with it's read-only fields updated (e.g. , ).

Updating an existing contact

You can avoid making two calls to the API by forcing a partial update.

Calling on the contact object marks it like it's already existing and coming from the API. The calls to the method when a contact is maked as existing will do only a partial update, i.e. update only the supplied fields and skipping all the fields. Do not forget that is a lookup field and required when updating or deleting the contact.

Deleting a contact

The newsletter object

The instances of the \Gan\Newsletter class represent the lists in the API. They have the following structure:

Required fields

Lookup field

Read-only fields

Retreiving, creating, updating and deleting a list

The CRUD operations on lists are no different from the operations on contacts:

Subscribing a contact to a list

You can also create a new contact automatically subscribed.


All versions of api-php with dependencies

PHP Build Version
Package Version
Requires nategood/httpful Version 0.2.*
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 getanewsletter/api-php contains the following files

Loading the files please wait ....