2017 © Pedro Peláez
 

library batch

Package providing a PHP implementation of the different Batch APIs functionality.

image

matchpint/batch

Package providing a PHP implementation of the different Batch APIs functionality.

  • Friday, June 15, 2018
  • by MarwanEB
  • Repository
  • 3 Watchers
  • 0 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Batch

This library includes several classes and methods to implement the different Batch API calls. You will find the documentation of the different API here., (*1)

Installation

Composer installation

To install Google Analytics, you first need to install Composer, a Package Manager for PHP, following those few steps:, (*2)

curl -s https://getcomposer.org/installer | php

You can run this command to easily access composer from anywhere on your system:, (*3)

sudo mv composer.phar /usr/local/bin/composer

Batch Installation

You can install this package using composer by running the command below., (*4)

php /usr/local/bin/composer/composer.phar require matchpint/batch

You can also add matchpint\batch to your the require of your composer.json as below, (*5)

{
    "name": "domain/your_project",
    "require": {
        "matchpint/batch": "~1"
    }
}

and run, (*6)

php /usr/local/bin/composer/composer.phar update

Prerequisites

This library implements the APIs provide by batch.com. You must get your API Key and Rest Key before using this project., (*7)

Usage

Regular usage

  1. Initialisation
use Batch\BatchCustomData;

$batchCustomData = new BatchCustomData($yourApiKey, $yourRestKey);
  1. Write as an array the body that you want to send to Batch (if needed)
$body = [
  "u.field_name" => "newValue",
  "ut.tags" => [
    "$add" => ["newTag"]
  ]
];
  1. Send the request to Batch using the function corresponding to the endpoint you need., (*8)

    $batchCustomData->send($customUserId, $body, FALSE);
    

    When you have two projects (iOS and Android)

    In case you have two Batch applications (iOS and Android), you probably want to make sure to send a call to each applications., (*9)

    You will find for each client an version of this class implementing calls for two applications (iOS / Android)., (*10)

    Convention: The client {Client} will have a IosAndroid{Client} equivalent that is implementing this., (*11)

Functionality

Custom Data API

Class: Batch\CustomData, (*12)

  • Update data: send(customUserId: string, values: array, override: boolean), (*13)

    • customUserId: Batch Custom Id described here for iOS and here for Android.
    • values: Array containing the values that should be sent to the API as described here.
    • override: Instead of merging the data we already have for a user, the existing data will be deleted and replaced by the incoming data (default to FALSE).
  • Update Bulk data: sendBulk(body: array), (*14)

    • body: Body of the request describe here
  • Delete member: TODO, (*15)

Class Batch\IosAndroidCustomData, (*16)

  • Update data:, (*17)

    • only on iOS: sendIOS(customUserId: string, values: array, override: boolean);
    • only on Android: sendAndroid(customUserId: string, values: array, override: boolean);
    • on both projects: send(customUserId: string, values: array, override: boolean).
  • Update Bulk data:, (*18)

    • only on iOS: sendBulkIOS(body: array);
    • only on Android: sendBulkAndroid(body: array);
    • on both projects: sendBulk(body: array).
  • Delete member: TODO, (*19)

Transactional API

Class: Batch\TransactionalAPI, (*20)

  • Send a push notification: sendPush(pushIdentifier, recipients, message, optionalFields), (*21)

    • pushIdentifier: (STRING) Name given to a given kind of push notification. ex: referral
    • recipients: (ARRAY[STRING[]]) Set of recipients ONLY ACCEPTED : ["tokens", "custom_ids", "install_ids"]. ex: ["custom_ids" => [162446]]
    • message: (STRING[]) Message to send to the user, must contain a title and a boy. ex: ["title" => "XXX", "body" => "XXXX"]
    • optionalFields: (ARRAY) Any kind of optional field that can precise push notification parameters. For more detailed information see here

Class Batch\IosAndroidTransactionalData, (*22)

  • Send a push notification:, (*23)

    • only on iOS: sendPushNotificationIOS(pushIdentifier, recipients, message, optionalFields);
    • only on Android: sendPushNotificationAndroid(pushIdentifier, recipients, message, optionalFields);
    • on both projects: sendPushNotification(pushIdentifier, recipients, message, optionalFields).

Campaigns API

TODO:, (*24)

The Versions

15/06 2018

dev-master

9999999-dev https://github.com/MatchPint/batch

Package providing a PHP implementation of the different Batch APIs functionality.

  Sources   Download

Apache-2.0

The Requires

 

api marketing php composer batch

24/04 2018

dev-feature/filesystemDependencies

dev-feature/filesystemDependencies https://github.com/MatchPint/batch

Package providing a PHP implementation of the different Batch APIs functionality.

  Sources   Download

Apache-2.0

The Requires

 

api marketing php composer batch

17/04 2018

dev-fix/Version

dev-fix/Version https://github.com/MatchPint/batch

Package providing a PHP implementation of the different Batch APIs functionality.

  Sources   Download

Apache-2.0

The Requires

 

api marketing php composer batch

04/04 2018

dev-feature/push-notification

dev-feature/push-notification https://github.com/MatchPint/batch

Package providing a PHP implementation of the different Batch APIs functionality.

  Sources   Download

Apache-2.0

The Requires

 

api marketing php composer batch

04/04 2018

dev-develop

dev-develop https://github.com/MatchPint/batch

Package providing a PHP implementation of the different Batch APIs functionality.

  Sources   Download

Apache-2.0

The Requires

 

api marketing php composer batch

16/02 2018

dev-feature/documentation

dev-feature/documentation https://github.com/MatchPint/batch

Package providing a PHP implementation of the different Batch APIs functionality.

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

api marketing php composer batch