mautic/core-lib
Core library for Mautic, the open-source marketing automation platform. Provides shared PHP classes, services, and utilities used across Mautic bundles, helping developers build and extend campaigns, contacts, segments, and integrations.
Architecture fit
The most important thing a TPM can do here is reclassify the artifact before anyone adds it to composer.json. mautic/core-lib is the shared core of the Mautic distribution — the entities, repositories, services, and event hooks that Mautic's own bundles extend. It is published as a Composer package so the Mautic monolith and its bundles can depend on it, not so that unrelated applications can. The metadata confirms the intent: 6 stars, 0 dependents, last release August 2022. If it were a viable third-party library it would have consumers by now. It does not.
So the architecture decision is not "which package do we install" but "do we operate a Mautic instance as a separate service." The answer, if yes, looks like: Mautic deployed on its own subdomain with its own PHP-FPM/Symfony 4.4 runtime, MySQL/MariaDB, and the full cron suite; our Laravel application talking to it over the REST API (basic auth for server-to-server, OAuth2 only if you genuinely need per-user scoping) and receiving form-encoded webhooks; a thin MauticClient interface binding the framework-agnostic mautic/api-library SDK inside a queued job layer; optionally mtc.js in the Blade layout for client-side tracking. Coupling is HTTP, so Laravel and Mautic version-drift independently — a benefit, and also a reason Composer's conflict resolution gives us no safety net at all.
Integration feasibility
Feasible, and the integration surface itself is small — an experienced engineer can complete an end-to-end spike (authenticate, upsert a contact, add to a segment, receive a webhook) in under a week. What makes it non-trivial is everything around the API call:
users/leads and Mautic contacts, keyed on email, with a local mautic_contact_id column and a backfill job.Rough sizing for planning: one engineer-week for the spike, three to five engineer-weeks for contact sync, segment/campaign consumption, and webhook handling, plus ongoing platform ownership. That is the number to put in front of whoever asked for marketing automation.
Technical risk
composer require and a sprint of work. Correct that in the first meeting, in writing.composer update in the Mautic root, doctrine:migrations:migrate, cache clear. It does not touch our integration contract. The risk is not this release; it is the habit of deferring Mautic releases generally.Key questions
Stack fit
Poor as a library, acceptable as a service. Mautic's Symfony 4.4 DI container and Doctrine ORM are entirely disjoint from Laravel's container and Eloquent; do not attempt to bootstrap Mautic inside a Laravel process. The seam that does fit is HTTP: Mautic's REST API is conventional JSON, and its webhooks are plain POSTs our existing queue workers can consume. Use mautic/api-library (framework-agnostic PHP, installs cleanly via Composer) behind our own MauticClient interface rather than calling SDK classes directly from controllers — that interface is what lets us swap to a hosted provider later without rewriting call sites.
Migration path
Nothing is currently installed, so this is provisioning and cutover rather than migration:
MauticClient with retry/backoff, a queue-backed outbox for writes, and a circuit breaker. Bind it as a singleton in a service provider so auth construction happens once, not per call.mautic_contact_id on the relevant local models plus a backfill job using createBatch()/editBatch() at 100 records per request.Compatibility
4.4.1 is API-compatible with the rest of the 4.4 line. The endpoints we would consume — /api/contacts, /api/segments, /api/emails, /api/forms, /api/fields — are stable across 4.x, and webhook payload shape is unchanged. Our Laravel version is irrelevant to compatibility because the coupling is HTTP. That also means compatibility is entirely our responsibility to manage: pin the Mautic version in infrastructure config, treat the API surface as a versioned interface with a contract test in CI, and remember that /api/leads and /api/contacts are the same resource under two names, which will confuse anyone reading the docs cold.
Sequencing
Phase 1 — spike: provision, authenticate, upsert and read back a contact, receive one webhook, confirm a segment triggers a campaign. This single path exercises auth, field aliases, the contacts endpoint, the segments endpoint, and cron — the five things that break first.
Phase 2 — contact sync and identity mapping, including backfill and reconciliation.
Phase 3 — segments and campaign data consumed by our application.
Phase 4 — email sending and engagement webhooks.
Phase 5 — bidirectional consent handling, erasure flows, and PII retention across both stores.
Insert a formal go/no-go gate at the end of Phase 1. The spike is cheap; the three-year operational commitment is not, and the decision is materially easier to reverse at that point than at Phase 4.
Maintenance
We take on a complete second PHP application: Composer updates in Mautic's own root, database migrations, cache rebuilds, the cron suite, and the eventual major-version upgrade to Mautic 5. Budget roughly one platform engineer at partial allocation for steady state, plus explicit marketing-ops ownership of configuration, campaigns, and segments. The 4.4 line will stop receiving security fixes; that date belongs on the roadmap on day one rather than surfacing as an incident. If we adopt 4.4.1, we should also budget the 4.4 → 5 migration before we have finished the initial build.
Support
Support splits awkwardly and will generate bounced tickets unless a written RACI exists. Nominally: marketing ops owns campaigns, segments, and templates; engineering owns the instance, credentials, webhook reliability, and patching. In practice every ambiguous issue lands on engineering. Note that Mautic 4.4 is community-supported — for anything customer-facing, a commercial Mautic host is usually the better procurement decision, trading licence cost for a supported upgrade path and a named escalation route. That comparison should be on the table before we self-host.
Scaling
Mautic scales like a monolith: vertically first, then read replicas. Its cron-driven segment rebuild degrades as the contact table grows — plan for segment sizes in the hundreds of thousands rather than millions without dedicated tuning, and treat contact-table growth as a capacity signal to watch, not a surprise. Our Laravel side scales independently as long as every Mautic call is queued rather than made in the request cycle. Also watch pagination: offset-based, limit hard-capped at 100, and no trustworthy total, so any sync loop must walk until an empty page rather than iterating a count.
Failure modes
application/x-www-form-urlencoded, not JSON. This is the most common integration bug and will break naive receivers.Ramp-up
Two to three weeks for an engineer new to Mautic to be productive in its Symfony codebase and API conventions; the API integration surface alone is a few days. Marketing-ops training on segment and campaign building is the longer tail and the more likely schedule risk. Three artifacts eliminate most of the recurring support load and should be written during Phase 1, not after launch: a cron-suite runbook, the OAuth/basic-auth setup and credential rotation procedure, and the contact identity and consent model.
How can I help you explore Laravel packages today?