Mautic is an open-source marketing automation platform built on Symfony (PHP). It provides a comprehensive suite for managing contacts (leads), creating and executing marketing campaigns, sending emails, building forms and landing pages, tracking user interactions, and integrating with third-party CRMs and services. The architecture is a modular monolith with bundles and plugins, a REST API, and a CLI console. Key data flows include contact tracking via tracking pixels and form submissions, campaign execution with scheduled events, email sending with bounce/feedback processing, and integration sync with external systems. External dependencies include MySQL/MariaDB, optional Redis/Memcached caching, a mailer transport, and various third-party APIs for IP geolocation, data enrichment, and social media. The codebase is actively maintained with extensive test coverage, modern PHP practices, and a plugin ecosystem.
This repository is a PHP client library for the Mautic marketing automation REST API. It provides a clean, object-oriented interface for performing CRUD and custom operations on Mautic entities such as contacts, campaigns, emails, segments, and companies. The library is built on PSR-18 (HTTP client) and PSR-7 (HTTP messages) abstractions, making it compatible with any modern PHP HTTP client via php-http/discovery. It supports three authentication methods: OAuth 1.0a, OAuth 2.0, and BasicAuth, each handling token lifecycle and refresh automatically. The architecture follows a factory pattern: the `MauticApi` class instantiates context-specific API classes (e.g., `Contacts`, `Emails`) that extend a common `Api` base class. The base class implements generic `get()`, `getList()`, `create()`, `edit()`, `delete()`, and batch operations, while context classes add custom endpoints (e.g., `addContact()` for campaigns). A fluent `QueryBuilder` allows building complex WHERE/ORDER/SELECT clauses for list requests. The library also includes a backwards-compatibility layer that transparently falls back to deprecated API URLs when a 404 is returned. External dependencies include any PSR-18 HTTP client implementation (e.g., Guzzle, Symfony HttpClient) and a PSR-3 logger (optional). The library is designed for integration into PHP applications that need programmatic access to Mautic data. It includes a legacy web-based API tester (`apitester/`) for manual testing, which vendors Bootstrap 3.2.0 and jQuery. The test suite requires a live Mautic instance and is run in CI against temporary installations. While the core library is modern and well-structured, the apitester UI is outdated and the backwards-compatibility layer introduces some technical debt. Overall, this is a solid, production-ready API client with good separation of concerns and reusable patterns.