Overview
themarketer/api-client is the official PHP client for The Marketer API.
What this package does
- Consumes The Marketer API from PHP applications through a clean, module-based client.
- Helps you integrate faster by keeping request payloads consistent and validated before sending.
- Provides a predictable integration flow: authenticate, call a module, send data, receive a response.
- Surfaces API failures in a clear way, so you can handle errors reliably in your code.
Requirements
- PHP
^8.1 - Composer
ext-mbstring
Core usage model
- Create a
Clientwith an array config: at minimumcustomerIdandrestKey; optionallytrackingKey,restUrl,trackingUrl,maxRetryAttempts(see Authentication). - Internally,
ClientbuildsConfigandApiContext. The context exposes:- REST traffic via
ApiGateway(queryk/ufor API calls underConfig::baseRestUrl()). - Tracking traffic via
TrackingGatewaywhen you use modules that send behavioral data to the tracking host.
- REST traffic via
- Access a module (for example
orders()). - Send a validated payload.
- Handle response data or exceptions.
Base URL for REST is built as {restUrl}/api/{apiVersion}/ (default apiVersion v1) — see Config::baseRestUrl() in src/Common/Config.php.
Available API modules
orders()subscribers()campaigns()products()transactionals()reports()events()coupons()loyalty()reviews()mobilePush()(mobile push)
Utilities:
Clientutilities- Errors & troubleshooting
- Claude Skill — official Claude skill for AI-assisted integration with this package