PHPackages                             matchpint/batch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. matchpint/batch

ActiveLibrary[API Development](/categories/api)

matchpint/batch
===============

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

150PHP

Since Feb 16Pushed 3y ago4 watchersCompare

[ Source](https://github.com/MatchPint/batch)[ Packagist](https://packagist.org/packages/matchpint/batch)[ RSS](/packages/matchpint-batch/feed)WikiDiscussions develop Synced 3d ago

READMEChangelogDependenciesVersions (9)Used By (0)

Batch
=====

[](#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](https://batch.com/doc/api/prerequisites.html).

Installation
------------

[](#installation)

### Composer installation

[](#composer-installation)

To install Google Analytics, you first need to install [Composer](http://getcomposer.org/), a Package Manager for PHP, following those few [steps](http://getcomposer.org/doc/00-intro.md#installation-nix):

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

You can run this command to easily access composer from anywhere on your system:

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

### Batch Installation

[](#batch-installation)

You can install this package using `composer` by running the command below.

```
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

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

and run

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

Prerequisites
-------------

[](#prerequisites)

This library implements the APIs provide by [batch.com](https://batch.com/doc/api/prerequisites.html). You must get your API Key and Rest Key before using this project.

Usage
-----

[](#usage)

### Regular usage

[](#regular-usage)

1. Initialisation

```
use Batch\BatchCustomData;

$batchCustomData = new BatchCustomData($yourApiKey, $yourRestKey);
```

2. Write as an array the body that you want to send to Batch (if needed)

```
$body = [
  "u.field_name" => "newValue",
  "ut.tags" => [
    "$add" => ["newTag"]
  ]
];
```

3. Send the request to Batch using the function corresponding to the endpoint you need.

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

### When you have two projects (iOS and Android)

[](#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.

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

**Convention**: The client `{Client}` will have a `IosAndroid{Client}` equivalent that is implementing this.

Functionality
-------------

[](#functionality)

### Custom Data API

[](#custom-data-api)

Class: [`Batch\CustomData`](https://github.com/MatchPint/batch/blob/master/src/Batch/CustomData.php)

- Update data: `send(customUserId: string, values: array, override: boolean)`

    - `customUserId`: Batch Custom Id described [here](https://batch.com/doc/ios/custom-data/customid.html) for iOS and [here](https://batch.com/doc/android/custom-data/customid.html) for Android.
    - `values`: Array containing the values that should be sent to the API as described [here](https://batch.com/doc/api/custom-data-api/set-update.html#_post-data).
    - `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)`

    - `body`: Body of the request describe [here](https://batch.com/doc/api/custom-data-api/set-update.html#_bulk-post-data)
- Delete member: **TODO**

Class [`Batch\IosAndroidCustomData`](https://github.com/MatchPint/batch/blob/master/src/Batch/IosAndroidCustomData.php)

- Update data:

    - 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:

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

### Transactional API

[](#transactional-api)

Class: [`Batch\TransactionalAPI`](https://github.com/MatchPint/batch/blob/master/src/Batch/TransactionalAPI.php)

- Send a push notification: `sendPush(pushIdentifier, recipients, message, optionalFields)`

    - `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" =&gt; \[162446\]\]*
    - `message`: (STRING\[\]) Message to send to the user, must contain a title and a boy. ex: *\["title" =&gt; "XXX", "body" =&gt; "XXXX"\]*
    - `optionalFields`: (ARRAY) Any kind of optional field that can precise push notification parameters. For more detailed information see [here](https://batch.com/doc/api/transactional.html#_request-structure)

Class [`Batch\IosAndroidTransactionalData`](https://github.com/MatchPint/batch/blob/master/src/Batch/IosAndroidTransactionalData.php)

- Send a push notification:

    - 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

[](#campaigns-api)

**TODO:**

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3a7739f5f1b6378a2df13b4d7ca3e2324c15fe48fd1525746ebea65444fa8ca?d=identicon)[MarwanEB](/maintainers/MarwanEB)

![](https://www.gravatar.com/avatar/06c0e0db1d8fcf2e1df2bde99db49f73455bf5b54023b2d0ebd6c460ec910e84?d=identicon)[PhilippeJung](/maintainers/PhilippeJung)

---

Top Contributors

[![MarwanEB](https://avatars.githubusercontent.com/u/17410248?v=4)](https://github.com/MarwanEB "MarwanEB (30 commits)")[![philippe-jung](https://avatars.githubusercontent.com/u/9883819?v=4)](https://github.com/philippe-jung "philippe-jung (30 commits)")[![gajMohan](https://avatars.githubusercontent.com/u/52197073?v=4)](https://github.com/gajMohan "gajMohan (3 commits)")[![pierresegonne](https://avatars.githubusercontent.com/u/32778266?v=4)](https://github.com/pierresegonne "pierresegonne (2 commits)")[![dedalozzo](https://avatars.githubusercontent.com/u/311248?v=4)](https://github.com/dedalozzo "dedalozzo (1 commits)")

### Embed Badge

![Health badge](/badges/matchpint-batch/health.svg)

```
[![Health](https://phpackages.com/badges/matchpint-batch/health.svg)](https://phpackages.com/packages/matchpint-batch)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
