PHPackages                             omnisend/php-sdk - 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. omnisend/php-sdk

AbandonedArchivedLibrary[API Development](/categories/api)

omnisend/php-sdk
================

Simple to use Omnisend API v3 wrapper

1.2(5y ago)4247.9k↓14.5%12[1 issues](https://github.com/omnisend/php-sdk/issues)[3 PRs](https://github.com/omnisend/php-sdk/pulls)1PHPPHP &gt;=5.3.0

Since Dec 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/omnisend/php-sdk)[ Packagist](https://packagist.org/packages/omnisend/php-sdk)[ RSS](/packages/omnisend-php-sdk/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (5)Used By (1)

Omnisend PHP-SDK
================

[](#omnisend-php-sdk)

Simple Omnisend API v3 wrapper in PHP.

Omnisend API v3 documentation can be found [here](https://api-docs.omnisend.com/).

Requires PHP &gt; 5.3, cURL or `allow_url_fopen` to be enabled.

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

[](#installation)

You can install Omnisend PHP-SDK by either using Composer either by downloading and including it manually.

#### Install using a composer

[](#install-using-a-composer)

1. Run these commands:

```
composer require omnisend/php-sdk
composer install

```

2. Add the autoloader to your application:

```
require_once("vendor/autoload.php");
```

**Note:** check and correct, if needed, "vendor/autoload.php" path.

#### Install manually

[](#install-manually)

Download the `Omnisend.php` file and include it manually:

```
require_once('Omnisend.php');
```

**Note:** check and correct if needed "Omnisend.php" path.

Available methods &amp; options
-------------------------------

[](#available-methods--options)

**Creating instance with your API Key and options (optional)**

```
$options = array(
    'timeout' => 30,
    'verifySSL' => false
);
$omnisend = new Omnisend('API-KEY', $options);
```

Available options:

NameTypeDescriptiontimeoutintTimeout. If not passed - will be calculated depending on PHP max\_execution\_timeverifySSLboolDefault - true. Enable (true) or disable (false) SSL verification.**Available methods**

`endpoint` - endpoint url (ex. 'contacts', 'products/prod123'). See [documentation](https://api-docs.omnisend.com/) for available endpoints.

`queryParams` - array of query parameters

`fields` - array of fields

- getSnippet() - returns html snippet code
- get(endpoint, queryParams) - make `GET` request.
- push(endpoint, fields, queryParams) - makes `POST` request. If error occurs (resource exists in Omnisend) - makes `PUT` request. This method can be used if you don't know if item exists in Omnisend. `queryParams` - optional.
- post(endpoint, fields, queryParams) - make `POST` request. Used to create new item in Omnisend. Will return an error if an item already exists in Omnisend. `queryParams` - optional.
- put(endpoint, fields, queryParams) - make `PUT` request. Used to replace item in Omnisend. Will return an error if an item doesn't exists in Omnisend. `queryParams` - optional.
- patch(endpoint, fields, queryParams) - make `PATCH` request. Used to update item in Omnisend. Will return an error if an item doesn't exists in Omnisend. `queryParams` - optional.
- delete(endpoint, queryParams) - make `DELETE` request. Used to delete item in Omnisend. Will return an error if an item doesn't exists in Omnisend. `queryParams` - optional.

Responses
---------

[](#responses)

Each method will return `false` in case of an error, `array` (see [documentation](https://api-docs.omnisend.com/) for responses) or `true` (for empty body (204) responses) in case of a success.

So you can easily check if a request was successful:

```
$cart = $omnisend->delete('carts/cart-123');
if ($cart) {
    //request was successful
} else {
    //there was an error
}
```

In case of a failed request, you can get an error description with `lastError()`:

```
 var_dump($omnisend->lastError());
```

Output will be an array with:

- error - error description
- statusCode - HTTP response [status code](https://api-docs.omnisend.com/v3/overview/responses)
- fields - optional - array of missing required, incorrect or incorrectly formatted `fields` (passed with a request)

Example:

```
array {
  ["error"]=> "2 error(s) found. Check 'fields' array for details."
  ["statusCode"]=> 400
  ["fields"]=>
  array {
    [0]=>
    array {
      [0]=> "cartSum: field required but not found in Json"
    }
    [1]=>
    array {
      [0]=> "currency: field required but not found in Json"
    }
  }
}
```

Examples
--------

[](#examples)

1. Create an instance with your API key and options (optional)

```
$omnisend = new Omnisend('your-api-key');
```

2. Make a request, for example, create a new contact in Omnisend:

```
$contacts = $omnisend->post(
  'contacts',
   array(
       "email" => "vanessa.kensington@example.com",
       "firstName" => "Vanessa",
       "lastName" => "Kensington",
       "status" => "subscribed",
       "statusDate" => "2018-12-11T10:29:43+00:00"
    )
);
```

3. Check if a request was successful:

```
if ($contacts) {
    //request was successful

    //print response
    print_r($contacts);
    //get contactID from response
    $contactID = $contacts['contactID'];
} else {
    //there was an error
    print_r($omnisend->lastError());
}
```

See more examples in `examples/examples.php`

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~293 days

Total

3

Last Release

2146d ago

### Community

Maintainers

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

---

Top Contributors

[![arunas-ciesiunas](https://avatars.githubusercontent.com/u/84388853?v=4)](https://github.com/arunas-ciesiunas "arunas-ciesiunas (6 commits)")[![aurimas0219](https://avatars.githubusercontent.com/u/33134325?v=4)](https://github.com/aurimas0219 "aurimas0219 (1 commits)")[![bogusbd](https://avatars.githubusercontent.com/u/1072015?v=4)](https://github.com/bogusbd "bogusbd (1 commits)")[![krossroad](https://avatars.githubusercontent.com/u/4357373?v=4)](https://github.com/krossroad "krossroad (1 commits)")

---

Tags

pg-integrationsteam-integrations

### Embed Badge

![Health badge](/badges/omnisend-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/omnisend-php-sdk/health.svg)](https://phpackages.com/packages/omnisend-php-sdk)
```

###  Alternatives

[facebook/php-business-sdk

PHP SDK for Facebook Business

90923.5M35](/packages/facebook-php-business-sdk)[exsyst/swagger

A php library to manipulate Swagger specifications

35916.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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