Download the PHP package easymailing/sdk-php without Composer

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

easymailing/sdk-php

Official Easymailing SDK for PHP backends.

Alpha. Public API may still change before 1.0.0. Pin to a known version (e.g. "easymailing/sdk-php": "v0.6.0-alpha.0") in production.

📦 This is a read-only mirror. The SDK lives in the easymailing/easymailing-sdk monorepo under packages/php/. Submit issues, pull requests, and discussions upstream — every commit and tag here is auto-generated by a subtree split workflow. Packagist watches this mirror because it does not read composer.json from monorepo subdirectories.

Backend only

This SDK authenticates with a secret API key or OAuth access token. Do not use it in client-rendered code.

Requirements

Install

Quick start

Generated resources

Most API endpoints are exposed as generated resources on the client. The full reference lives in docs/resources.md.

Common call shapes:

Request bodies can be plain arrays or generated DTOs. Entity methods return generated DTOs; collection methods return Page<DTO>.

Auth

Pass exactly one of apiKey or accessToken. The constructor throws on both/neither and on empty strings.

Hydra identity: iri + uuid

Every generated DTO carries ?string $iri (the Hydra @id verbatim) and ?string $uuid (the trailing UUID segment) as first-class typed properties. The @id, @type and @context keys are stripped — they're transport metadata, not domain fields.

If you only have an IRI (e.g. from a webhook payload), use IriExtractor to peel off the trailing segment:

Transports

Three transports ship in the box:

Bodies are JSON-encoded automatically and the SDK sets Content-Type: application/json on POST/PUT/PATCH/DELETE-with-body. If you pass your own Content-Type header (any casing) it wins — useful for application/merge-patch+json and similar.

Errors

All API errors derive from EasymailingException and follow RFC 7807:

The client retries idempotent requests, 429s, and 503s with exponential backoff. Configurable via the maxRetries constructor arg.

Telemetry events

Plug in your own observability without the SDK depending on a specific logger. The client emits structured SdkEvent instances for every request lifecycle stage, batch poll, and webhook signature check through a single onEvent callable.

Event types

Type constant When
EventTypes::REQUEST_START Before the request leaves the SDK.
EventTypes::REQUEST_RETRY The SDK is about to retry (429, 5xx, network).
EventTypes::REQUEST_END Request finished. status + optional error + durationMs.
EventTypes::BATCH_POLLING Each poll iteration in batch->wait(). Carries snapshot progress.
EventTypes::BATCH_FINISHED Batch reached finished.
EventTypes::BATCH_TIMEOUT wait() ran past maxWaitMs — BatchTimeoutException is thrown.
EventTypes::WEBHOOK_VERIFIED webhooks->verify() accepted the signature.
EventTypes::WEBHOOK_REJECTED webhooks->verify() rejected (signature-mismatch, invalid-format, invalid-secret).

Each SdkEvent carries type, v: 1 (schema version), timestampMs, optional requestId (16-char hex — same value across start / retry / end for one logical request), method, path, pathTemplate, and a payload array specific to the event type.

PSR-3 adapter

If you already use a PSR-3 logger (Monolog, Symfony, Laravel, etc.), the SDK ships a Psr3EventListener that maps event types to log levels with a sensible default (5xx → error, retry/4xx/timeout/webhook-rejected → warning, everything else → debug):

The adapter requires psr/log — install it explicitly if your project doesn't already pull it in (composer require psr/log).

Safety, correlation, cardinality

Batch

The /batch_operations endpoint is asynchronous: you submit up to 500 operations, the server processes them in the background, and the SDK polls until done. The whole flow can take seconds to many minutes depending on size and rate limits.

Two flavours

run() — blocking, for CLI / workers / long-lived processes:

Polling uses exponential backoff (1s → 2s → 4s → ... cap 30s) with jitter. Default maxWaitMs is 30 minutes; on timeout, BatchTimeoutException is thrown but the batch keeps running server-side and the exception carries the UUID so a worker can resume.

runAsync() — fire-and-forget, for HTTP / Symfony controllers / FPM:

Why fetchResponsesGuaranteed() and not plain fetchResponses()? The API writes the results file asynchronously after the status flips to finished, and auto-deletes it 1 hour later. fetchResponsesGuaranteed calls the regenerate endpoint when the file isn't there — covering both the post-finish race window and old batches whose file already expired. Use the bare fetchResponses($snapshot) only when you already know the snapshot has a fresh response_body_url.

Why two methods? PHP-FPM has max_execution_time (typically 30–60 s). Calling run() from a controller will deadlock against that timeout for any non-trivial batch. Use runAsync() there and wait() from a worker.

Low-level primitives

create, get, wait, fetchResponses, errors, regenerateResponseBodyUrl are all exposed for custom flows. The presigned response_body_url expires after 15 minutes — use regenerateResponseBodyUrl($uuid) to get a fresh one if you need to download the file again.

No batch.finished webhook

The API does not currently emit a webhook event when a batch finishes. You must poll (or subscribe to the SDK's batch.finished telemetry event if your own process did the wait).

Webhooks

verify() uses hash_hmac + hash_equals (constant-time). Signature must start with sha256= followed by hex. Both verified and rejected outcomes are emitted as webhook.verified / webhook.rejected telemetry events.

parse() returns an array{event_type: string, webhook_id?: string, data: mixed} (a discriminated array shape, not an object — keeps the wire payload faithful).

Typed event constants

The WebhookEvents class exposes one public const per known event_type. Compare against it instead of hand-writing string literals:

WebhookEvents::all() returns the full list. The catalogue is generated from the upstream WebhookEventType PHP enum (composer generate:webhooks). $event['data'] stays loosely typed (mixed) for now; a follow-up plan will tighten it once the upstream payload DTOs are catalogued.

Changelog

See CHANGELOG.md. Releases ship via release-please: a feat: or fix: commit in the monorepo opens a Version PR; merging it tags the monorepo, the split workflow propagates the tag to this mirror, and Packagist auto-publishes via webhook.

License

MIT — see LICENSE.


All versions of sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
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 easymailing/sdk-php contains the following files

Loading the files please wait ...