Easymailing

PHP

Integrate Easymailing into your PHP backend with the official SDK.

The easymailing/sdk-php package supports PHP 8.1 and later. Its default transport requires the JSON and cURL extensions.

Install

composer require easymailing/sdk-php:0.6.0-alpha.0

List audiences

Set EASYMAILING_API_KEY in your server environment, then create a client:

<?php

require __DIR__ . '/vendor/autoload.php';

use Easymailing\Sdk\Easymailing;

$apiKey = getenv('EASYMAILING_API_KEY');
if ($apiKey === false || $apiKey === '') {
    throw new RuntimeException('EASYMAILING_API_KEY is required');
}

$client = new Easymailing(apiKey: $apiKey);
$page = $client->audiences->list(['page' => 1]);

foreach ($page->data as $audience) {
    echo $audience->iri, ' — ', $audience->title, PHP_EOL;
}

Continue with the SDK reference

On this page