Download the PHP package cleverreach/php-sdk without Composer
On this page you can find all versions of the php package cleverreach/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cleverreach/php-sdk
More information about cleverreach/php-sdk
Files in cleverreach/php-sdk
Package php-sdk
Short Description PHP SDK for the CleverReach REST API
License MIT
Homepage https://github.com/cleverreach/cleverreachsdk-php
Informations about the package php-sdk
CleverReach PHP SDK
A lightweight PHP SDK for the CleverReach REST API. Built on PSR-18 / PSR-17 interfaces
Table of Contents
- Requirements
- Installation
- Quick Start
- Features
- Typed Service API
- Groups
- Receivers (via group)
- Receiver lookup
- Raw API Access
- Error Handling
- Advanced: Bring Your Own HTTP Client
- Development
- License
Requirements
| Requirement | Version |
|---|---|
| PHP | 8.2 or higher |
| Composer | 2.x |
You also need one PSR-18-compatible HTTP client in your project. Popular choices:
The SDK auto-detects the available client via php-http/discovery – no additional configuration needed.
Installation
Quick Start
Get up and running in under a minute:
That's it. The SDK handles authentication, JSON encoding/decoding, and error mapping automatically.
Get your API token in the CleverReach backend under Account → Extras → REST API.
Features
- Zero boilerplate – one class, one method
- PSR-18 / PSR-17 – works with Guzzle, Symfony HTTP Client, or any compliant client
- Auto-discovery – no manual HTTP client setup required
- Typed service API – key endpoints covered by dedicated service methods with full IDE autocompletion and type-safe enums
- Raw access – every CleverReach REST endpoint reachable with
request()
Typed Service API
The SDK provides typed service classes for the most common endpoints. These are the recommended way to interact with CleverReach – your IDE will autocomplete parameters and the compiler will catch type errors.
Groups
Receivers (via group)
Receiver lookup
Error Handling
All service methods and request() throw exceptions from CleverReach\SDK\Exception\:
| Exception | When |
|---|---|
AuthenticationException |
401 – invalid or expired API token |
ValidationException |
400 – bad request (invalid payload or parameters) |
ResourceNotFoundException |
404 – resource does not exist (e.g. invalid group ID) |
RateLimitExceededException |
429 – too many requests |
MissingDependencyException |
No PSR-18 HTTP client found at construction time |
CleverReachException |
Any other API error (4xx/5xx), network failure, or invalid JSON |
All specific exceptions extend CleverReachException, so you can catch all errors with a single catch block, or handle specific cases:
Raw API Access
All requests go through the single request() method:
| Parameter | Type | Description |
|---|---|---|
$method |
string |
HTTP verb: GET, POST, PUT, DELETE |
$endpoint |
string |
Path relative to https://rest.cleverreach.com/v3/ |
$query |
array |
URL query parameters (null values are ignored) |
$json |
array\|null |
Request body, JSON-encoded automatically |
Returns array – either an associative array (single object) or a list of associative arrays.
Example: Custom Endpoint
If an endpoint is not yet covered by the typed services, you can easily call it directly:
Full API Reference
The examples above cover the most common use cases. The CleverReach REST API offers many more endpoints – reports, forms, attributes, filters, orders, events, and more.
→ CleverReach REST API Documentation Full endpoint reference, request/response schemas, and interactive Swagger UI.
Advanced: Bring Your Own HTTP Client
By default the SDK uses php-http/discovery to find a PSR-18 client automatically.
You can inject your own implementations – ideal for DI containers or testing:
Example: Guzzle with explicit setup
Development
License
This project is licensed under the MIT License. See the LICENSE file for details.
All versions of php-sdk with dependencies
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
php-http/discovery Version ^1.19.2
psr/http-message Version ^2.0