Building a custom Mautic plugin

A custom Mautic plugin extends the platform through its own Symfony bundle in plugins/, not by editing core. This page explains the structure, the decisions to make first, and the work a team can keep or hand to a partner.

On this page

When a custom Mautic plugin is the right way to extend Mautic

A custom plugin is the right tool when a team needs Mautic to do something that neither the core product nor an existing plugin does, and when that behavior has to live inside Mautic rather than in another system. Mautic is written in PHP on the Symfony framework, and its GitHub repository is licensed under GPL-3.0, so your team can read the core source, build on it and ship the extension under the same license terms. Extensions belong in the plugins/ directory as a Symfony bundle, with its own namespace, configuration and service definitions. That placement is what keeps your code separate from core files, which matters for every upgrade that follows. Before writing code, confirm the requirement against the current release, because a plugin that works on one release line may need changes on the next.

Start with the cheaper options. Many needs are met by configuration alone: custom fields, segments, campaign logic, forms, email templates and user roles can often be changed in the admin interface without touching code. Next, check the Mautic Marketplace and the official plugin documentation for an existing integration, such as the HubSpot or Salesforce plugins, and review its maintenance status and version compatibility before you commit to it. If the need is to move data between Mautic and a system you already run, a separate integration service that reads and writes through the API or webhooks may be easier to maintain than a plugin that runs inside Mautic's process. Ask the vendor or plugin author which Mautic releases they test against.

A plugin is most justified when the behavior must run on Mautic's own events, such as contact changes, campaign actions or form submissions, or when it must add a new channel, field type or integration that the core product cannot host. In that case, the team should write a scope that names the events and entities involved, the Mautic release line to target, the PHP and database versions that release requires, and an owner for ongoing maintenance. Plan the plugin as a dependency that must be retested at each upgrade. Also confirm that the plugin does not replace core classes, since overriding core behavior is the change most likely to break the next upgrade.

What a Mautic plugin can extend

A Mautic plugin hooks into the platform at a small set of extension points, most of them provided by Symfony and Mautic's own integration layer. The cards below list the points a plugin usually works with and what to confirm for the version you run. Class names, hook points and registration methods can differ between release lines, so verify each one against your installed version before you commit to a design.

Integrations framework

A plugin can register an integration that appears in Mautic's integration settings, with its own configuration, authentication and sync logic. This is the extension point for CRM and data sync work, and it is the one most teams will use first. Confirm the interfaces and registration method in your version before you scope the sync work, because the contract may differ between release lines and a plugin written for one line may not load on another.

Services and autowiring

Mautic is built on Symfony, so a plugin declares its services in its bundle configuration and the Symfony container injects dependencies into them. Autowiring lets a service receive core services by type, which keeps plugin code tied to public service types. Confirm the service configuration keys and autowiring defaults your version uses, and avoid aliasing or redefining core services you do not own.

Console commands and cron

A plugin can ship console commands that run on a schedule alongside Mautic's own jobs. The cron documentation says segment updates, campaign updates and campaign triggers should be staggered, so a plugin job that touches contacts adds to that load. Schedule plugin commands in the same cron plan and confirm how your version discovers plugin commands before you rely on them in production.

Cron jobs docs

Event listeners and subscribers

Event subscribers let a plugin react to events that Mautic dispatches during normal operation without editing core files. This is generally the cleanest way to add behavior that runs alongside core activity. Event names and payloads are version-specific, so list the events you need, confirm each one exists in your release, and check what data the payload carries before you write the listener.

Routes, controllers and admin pages

A plugin can add its own routes and controllers, for example a settings page or an administrative report, and render them with Twig templates from its bundle. Keep route paths, permission checks and menu entries explicit so administrators can see who can reach each page. Confirm how your version registers plugin routes and menu items, and test each page with a user role that lacks the required permission.

Core overrides and upgrade risk

Replacing a core class or template by name works only until an upgrade changes that file, and then the plugin can fail silently or stop loading. This is the main reason to prefer events, services and integration interfaces over overrides. Before you build, list every core class or template the plugin touches, compare each one with the release you plan to upgrade to, and rehearse the upgrade on a staging copy.

How the plugin bundle is structured in plugins/

A Mautic plugin is a self-contained Symfony bundle placed in the plugins/ directory of the Mautic install, and the folder layout is the first thing a developer must get right. Each plugin sits in its own folder whose name ends in Bundle, such as HelloWorldBundle, and that folder holds the bundle class, the Config/ directory with the plugin's configuration and service definitions, and the subfolders for controllers, models, event listeners, forms and templates. Treat the core project's own plugins as the reference for naming and file placement, and confirm the exact file set and folder conventions against the target release by reading the bundles in the Mautic GitHub repository before writing any code. Do not assume a layout copied from an older tutorial will load on the version you run.

Classes inside the bundle live in the MauticPlugin namespace, with the bundle name as the second segment, so a listener in HelloWorldBundle would sit under MauticPlugin\HelloWorldBundle. The namespace must match the folder path because the autoloader resolves classes from the filesystem, and a mismatch is one of the most common reasons a plugin appears installed but fails at runtime. Registration happens through the bundle's configuration and the plugin screen in the admin area, where Mautic discovers the new folder. Confirm the discovery and reload steps for your release, because they change between versions. Within the service configuration, Symfony autowiring and autoconfiguration can resolve constructor dependencies and tag event subscribers automatically. Teams should check which defaults their release enables and keep explicit service definitions only where the wiring cannot be inferred.

The bundle boundary matters most at upgrade time. Code kept inside plugins/ and wired through the bundle's own configuration can be reviewed, versioned and re-tested separately from the core application. Changes to core files, or a plugin that replaces core services to change their behavior, tie the custom code to internal details that move between releases, so each upgrade may break in ways the plugin cannot detect. Before the first production install, have the build team run the plugin on a staging copy of the same release, clear the cache, confirm the plugin loads without errors in the logs, and record the release and PHP version it was tested on. Those records are the baseline for the next upgrade test.

Decisions to make before writing code

This table compares the four structural decisions a team faces before building a Mautic plugin: bundle or existing plugin, autowiring or explicit services, Composer packaging or local install, and database or environment configuration. Read each row for the options, when each fits and what it costs to maintain after the first release.

DecisionOptions and when each fitsMaintenance cost
Bundle or existing pluginExtend a bundle that already ships with Mautic only when its events and services cover your need. Build a new bundle in plugins/ when the behavior is new or distinct from existing integrations.Forking an existing plugin means tracking its changes on every upgrade. A new bundle is your code to keep working across releases.
Service autowiringAutowiring suits services that follow standard constructor injection and keeps the service file short. Explicit service definitions suit services that need specific arguments, tags or decorators.Autowiring is quicker to change but can hide wiring errors until runtime. Explicit definitions are more verbose but easier to audit during upgrades.
Composer packagingComposer packaging fits plugins you will install on several instances or distribute to others, since dependencies and autoloading are declared. A local install in plugins/ fits a single instance with few dependencies.Packaging adds a versioned release process and dependency updates. A local install avoids that overhead but makes reproducible deployments harder.
Configuration storageDatabase storage through the plugin configuration screen suits settings administrators change without a deploy. Environment settings suit secrets and values that differ by environment and should not be editable in the UI.Database settings need an admin workflow and careful handling of encrypted values. Environment settings need deployment changes and documentation for each environment.
Upgrade compatibilityBuild against public extension points such as events and documented services. Avoid replacing core classes, since a core update can change the replaced code and break the plugin silently.Core overrides require a diff and retest on every release line you run. Public extension points usually need fewer changes but still require testing against each target version.

Why overriding core classes breaks Mautic upgrades

A plugin that subclasses or edits a core class ties your instance to the exact release that class came from. When Mautic ships a patch, minor or major release, the core class you copied or extended may have changed its method signatures, constructor arguments, service names or event behavior. Your code keeps working on the old release and fails in ways that are hard to see on the new one, sometimes only on a code path that runs at night through a cron job. Mautic's stated cadence adds pressure: monthly patch releases, minor releases every three months and major releases every two years mean a core override can be exposed to change several times a year, and a major release can rewrite the internals it depends on.

The supported alternative is to build on the extension points Mautic exposes to plugins: its event listeners, service definitions registered through the plugin's own configuration, and the integration and form interfaces documented for plugin authors. Declare what you use, keep your logic in your own bundle under plugins/, and avoid reaching into classes under app/ or vendor/. Before you start a build, ask the developer which Mautic release line you target and which extension points each feature depends on, and record that list in the design. If a feature cannot be built without an override, treat that as a scope risk to raise with the client before work starts, not as a detail to solve in code.

Every Mautic upgrade should be rehearsed on a staging copy that matches production in release, PHP version, plugin set and configuration, then checked against the plugin's functions and its scheduled jobs before production is touched. Confirm the target release against Mautic's own release schedule and the support dates it publishes, and check the PHP and database versions the target release requires. Plan a regression pass for each custom plugin, including the campaign actions, form behavior and background commands it adds, and keep a rollback route, such as a tested backup, ready before the production upgrade runs. Plugins that were built on supported extension points usually need a version bump and a test pass, while plugins that override core usually need rework, which is why the choice of extension point is also a maintenance cost decision.

How a plugin moves from design to production

The sequence turns a plugin idea into a reviewed, deployed and documented extension that the team can upgrade with the rest of Mautic. Each step closes with a specific output, so nothing reaches production without a version target, a tested build and a written record.

  1. Scope the requirement and its boundaries

    Write down what the plugin must do, which Mautic objects it reads or writes (contacts, segments, campaigns, emails or forms), and which parts of Mautic it must not change. The product owner and the Mautic administrator sign off on this. The output is a short written scope that lists the hook points the plugin will use and states that core classes stay untouched, because overriding core classes is what breaks upgrades. The step is done when every requirement maps to a hook point or is marked out of scope.

  2. Confirm the target Mautic version and PHP support

    Pick the Mautic release line the instance runs or will run, then check its PHP support and system requirements against the official requirements page. Mautic 7.0 supports PHP 8.2 through 8.5, and the security support windows for each release line differ, so the lifecycle dates matter as much as the feature set. Confirm which release line the plugin targets and how long it stays supported. The output is a one-page compatibility note naming the Mautic version, PHP version and database versions the plugin is built and tested against.

  3. Build in a development install

    Set up a local development instance from the GitHub repository or the Composer project template, then create the plugin as a Symfony bundle under the plugins directory with the MauticPlugin namespace. Rely on autowiring for service wiring and keep configuration in the bundle's own files. The developer confirms the plugin appears and activates in the plugin manager on a clean install. The output is a working plugin branch in version control and a development environment that any team member can rebuild from documented commands.

  4. Test against a staging copy

    Copy the production database and files into a staging environment that matches production's PHP, web server and database versions, then install the plugin there. Run it against realistic contact volumes, its cron jobs and any queue consumers it depends on, and check that scheduled work does not overlap with Mautic's own jobs. Test the upgrade path too: install the plugin on the target Mautic release, then apply the next patch release. The output is a test record listing each scenario, the result and any defects fixed before release.

  5. Review the code before release

    A second developer, ideally one who did not write the plugin, reviews the code for core class overrides, direct database queries that bypass Mautic services, hard-coded credentials, unescaped output and error handling around external API calls. Confirm the license of any bundled dependency is compatible with the GPL-3.0 license of Mautic. The output is a review record with each finding marked resolved or accepted, and a signed-off release candidate tag in version control.

  6. Deploy to production with a rollback plan

    Deploy the tagged release through the same process used for Mautic itself, with a fresh backup of the database and files taken immediately before the change. Enable the plugin, verify its cron jobs are registered and staggered, and watch the first campaign or segment cycles for errors in the logs. Write the rollback steps before deployment starts, including how to disable the plugin and restore the backup. The output is a deployment record showing the release tag, the time of change, the backup identifier and the first-cycle verification results.

  7. Document the plugin for operators

    Write the documentation the next administrator needs: purpose, supported Mautic and PHP versions, configuration keys, cron jobs, required queue workers, credentials and where they are stored, and the upgrade steps for each future Mautic release. Record who owns the plugin and who approves changes. The output is a maintained runbook stored with the code, and a named owner who will check the plugin against each Mautic release line before the instance moves to it.

What drives plugin effort and cost

This table lists the factors that move the effort of a custom Mautic plugin up or down, why each one matters, and what to ask for in a written quote. Use it to compare scope options before you ask a partner or your own team for an estimate. The main takeaway is that the number of extension points, the external API and the Mautic versions you must support usually matter more than the plugin's visible feature list.

DriverEffect on effortWhat to ask for in a quote
Extension points touchedEach hook into Mautic events, forms, campaign actions or integrations adds design, wiring and regression work. A plugin touching several points costs more than one with a single hook.A list of every event, form, campaign or integration hook the plugin uses, with the bundle files expected to change.
External API complexityAuthentication flows, pagination, rate limits, error codes and sandbox availability for the target system drive most build and debugging time.Which endpoints are in scope, the auth method, whether a sandbox account is provided, and how rate limit errors are handled.
Data mappingField mapping between Mautic contacts, companies and the external system grows with the number of fields, custom fields and direction of sync. Two-way sync needs conflict rules.A field-by-field mapping sheet and a stated rule for which system wins when both change.
Credential handlingStoring and rotating API keys or tokens through Mautic's configuration and encryption path, and keeping them out of logs, adds design and review time.Where secrets are stored, how they are rotated, and confirmation that they are never written to logs or source control.
Queue and cron behaviorWork that runs in cron jobs or the messenger consumer must be idempotent, staggered and safe to retry. Real-time calls inside requests are simpler but riskier at volume.Which work runs synchronously and which runs in background jobs, plus retry and failure handling expectations.
Test coverageAutomated tests for the plugin logic, mocked external calls and at least one staging run against Mautic add effort but lower the cost of later upgrades.The test types included (unit, integration, end-to-end), the environments used, and who runs acceptance tests.
Mautic versions supportedEach supported release line may need separate compatibility checks because core classes and services can change between versions. Supporting several lines multiplies testing.The exact Mautic release lines covered, the PHP versions covered, and the process for retesting after each monthly patch or later release.
Ongoing maintenanceUpgrades to Mautic and to the external API recur over the plugin's life. A plugin that avoids core class overrides is usually cheaper to keep working.Whether maintenance is a separate retainer, what it covers, and who is responsible for regression testing after each upgrade.

How a plugin connects to cron, queues and the rest of the stack

A custom plugin rarely runs in isolation. Its background work competes with Mautic's own scheduled jobs, and the team should decide how those jobs are scheduled before the plugin goes live. Mautic depends on cron jobs for segment updates, campaign updates and campaign triggers, and the Mautic cron jobs documentation says these should be staggered rather than all started at the same moment. If a plugin adds a command, a listener that writes to the database or a job that calls an external CRM, it adds load to the same database and PHP workers. Ask which cron entries the plugin needs, how often they run, and whether they can start at a different offset from the core jobs.

The second dependency is the messenger consumer. When emails are queued, Mautic hands sending work to a worker, and the broadcasts command handles segment emails. A plugin that dispatches its own messages, or that hooks into email sending, must confirm which transport and worker processes will pick up those messages in your environment. Test the plugin with the consumer running under the same supervisor settings you plan to use in production, and confirm that a failed message is retried or logged rather than lost. Also confirm that the plugin's own cron commands are registered in the same way as the core ones, so a missing entry is caught during deployment rather than discovered later as stalled campaigns.

Before release, document a short dependency map: each plugin job, its schedule, its queue, the database tables it touches and the external services it calls. Confirm the exact cron and worker configuration against the version of Mautic you run, because these details change between release lines. The Mautic cron jobs documentation is the starting point for that check. A plugin that cannot be scheduled, monitored and restarted with the rest of the stack is an operational risk, even if its code is correct.

Systems a custom plugin usually connects to

A custom Mautic plugin rarely works alone. It usually touches a CRM, an identity provider, an email transport and Mautic's own API and webhooks. Each connection has its own requirements and version constraints, so confirm them against the current documentation before the design is fixed.

CRM sync reference plugins

The HubSpot plugin pushes Mautic contacts to HubSpot CRM based on contact actions or point triggers, and the Salesforce integration page covers the same kind of sync. Read them as reference points for how Mautic models integration settings, field mapping and triggers, not as code to copy. Confirm the CRM API version, auth method and rate limits your CRM enforces before designing your own sync.

HubSpot plugin docs

SAML single sign-on

Mautic can integrate with a SAML identity provider, but the provider must send email, first name and last name attributes. The documentation describes no LDAP option, so a plugin that assumes directory lookups will not match the supported setup. Confirm the authentication docs for your Mautic release line and test attribute mapping in staging before any user-facing login change.

Authentication docs

Email transports

Mautic sends email through transports, and a plugin that adds or changes a transport must follow the transport interface Mautic exposes rather than the sending code path. Check how the transport handles bounces, unsubscribes and tracking, and whether your sending provider's requirements, such as authentication records, apply to the new route. Test deliverability on a small list first.

Mautic REST API and v2

External systems and plugins often read or write contacts through the Mautic API. Decide early whether the plugin calls the original REST API or the API Platform based /api/v2 endpoint, since each has different authentication and endpoint behavior. Confirm which authentication grant the plugin will use and design a dedicated API user with the narrowest permissions it needs.

Webhooks and queued events

Webhooks send contact activity to other systems, and the webhook processing cron job controls when queued events are delivered. A plugin that reacts to events should expect batched, delayed delivery rather than instant delivery, and it must handle deactivation after repeated errors. Confirm payload structure and retry behavior for your release before depending on them.

Cron and queue dependencies

A plugin that adds scheduled work or queued jobs depends on Mautic's cron jobs and, when emails are queued, a messenger consumer. Stagger the plugin's jobs with the core jobs and confirm that the server runs the required processes. Missing consumers or overlapping schedules are a common reason custom integrations appear to fail without any code error.

Cron jobs docs

Questions teams ask before building a Mautic plugin

How much does a custom Mautic plugin cost and what drives it?

The cost is the engineering effort to specify, build, test and maintain the plugin, because Mautic itself has no license fee. Mautic has no paid edition of the software, and its GitHub repository is licensed under GPL-3.0, so the spending goes to people, test environments and hosting. The main drivers are the number of integration points, how much contact and consent data the plugin reads or writes, whether it calls an external API with its own authentication and error handling, and how many environments need testing. One-time work covers discovery, build and acceptance testing. Recurring work covers keeping the plugin working through each Mautic release. Ask any quote to separate these lines and to state who maintains the plugin after handover.

How long does it take to build a Mautic plugin?

Duration depends mostly on how well the requirements are defined before the build starts. The timing is set by the number of entities and fields the plugin touches, the complexity of the external system's API, the number of triggers and events it must respond to, and whether the team can supply test data and a staging instance that matches production. A plugin that adds a custom field or a campaign action is shorter than one that runs background sync to a CRM with retries and conflict rules. Testing with production-sized contact volumes, including a cron-driven run, often takes longer than the first build. Ask for a written schedule with milestones and confirm that testing against the next Mautic release is included.

What does a custom Mautic plugin need from our internal team?

Plan for three roles: a business owner, a developer who can review code, and an operator who runs the server. The business owner defines the outcome, approves the consent and data handling rules, and signs off the acceptance tests. Engineering needs a staging copy of the instance on the same Mautic release and PHP version as production, test credentials for the external system, and sample contacts that contain no real personal data. Operations must confirm that the cron jobs for segment updates, campaign updates and campaign triggers run on the instance, since plugin behavior often depends on them. Ask any build partner to list these dependencies in the written scope before work starts.

Can an in-house developer build a Mautic plugin?

Yes, if the developer knows PHP and Symfony well enough to work inside Mautic's plugin structure. Plugins live in the plugins/ directory as Symfony bundles under the MauticPlugin namespace, and their services rely on autowiring, so the developer must understand service configuration and dependency injection. Confirm the PHP version for your target release, since Mautic 7.0 requires PHP 8.2, 8.3, 8.4 or 8.5. The main risk for in-house teams is rarely the first build. It is the overrides, workarounds and undocumented core dependencies that accumulate over time and make later upgrades costly. A short architecture review by an experienced Symfony developer before the build shows whether the work fits in-house capacity.

How do Mautic upgrades affect a custom plugin?

Upgrades affect a custom plugin mainly when it depends on internal core code, because core classes can change between releases. Mautic publishes monthly patch releases, minor releases every three months and major releases every two years, so a plugin will be checked against several versions each year. Plugins that use the bundle structure and public services usually need less rework than plugins that override or replace core classes, which tend to break at upgrade time. Mautic 7.2 receives active and security support until 30 September 2026, and Mautic 7.3 is planned as the long-term support release with security support through 31 December 2027. Ask who owns the fix when an upgrade breaks the plugin.

When should we use a Marketplace plugin instead of building one?

Use a Marketplace plugin when it already does the job, is actively maintained and supports your Mautic release. Build a custom plugin when the requirement depends on your data model, internal systems or approval rules that no public plugin covers. Before choosing, check the plugin's source code, its license, the date of its last update, the Mautic versions it supports and whether it has been tested on your PHP version. Also check whether it relies on core behavior that may change in a future release. A custom build carries ongoing maintenance cost, so a plugin that solves a common problem may be cheaper to adopt and configure than to write. Compare the cost of each option across several upgrade cycles, including the first installation.

Does a custom Mautic plugin change our security obligations?

A plugin runs inside the Mautic application, so it can read and change contact data, consent records and stored credentials. Review what the plugin reads, what it writes and where it sends data before the build starts. Confirm how API keys are stored, and check that the plugin does not write personal data to application logs. Every change to consent or preference fields should respect the opt-in and opt-out state already recorded in Mautic. Test how the plugin handles failed external calls, and confirm its behavior if cron jobs run late or overlap. Security testing of the finished plugin, including its access paths, is a separate scope that should be written into the agreement.

Does GPL-3.0 licensing affect a custom Mautic plugin?

Mautic's GitHub repository is licensed under GPL-3.0, and the project offers no paid edition of the software, so using the core carries no license fee. Your plugin's license is a separate decision. If you distribute a plugin that is built on Mautic code, the GPL-3.0 terms can apply to that distribution, so have counsel confirm the position before sharing it outside your organization. Internal-only use raises different questions, which counsel should also review. Managed hosting and support contracts are separate purchases from the license. Ask any build partner which license the plugin will carry and who holds ownership of the code.

How DeployOpen scopes and delivers a Mautic plugin

DeployOpen approaches a custom Mautic plugin as a fixed-scope engagement, with the contact data, events and integration targets agreed in writing before any code is written. The plugin is built as a Symfony bundle inside plugins/, tested on a copy of your Mautic release, and handed over with documentation your team can maintain.

How we scope

  • Written scope defines the business goal, the Mautic objects the plugin reads or writes, and the target system it must reach.
  • Scope names the Mautic release line and PHP version the plugin must support, so compatibility is agreed before the build starts.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing; a quote follows from that written scope.

How we build

  • Code is structured as a bundle under plugins/ using the MauticPlugin namespace, with services registered through autowiring.
  • Core classes are extended through events and services rather than overridden, so the plugin does not depend on patched core files.
  • Each build is tested in a staging instance on the same release line as production, including cron-driven and queued behavior.

How we hand over

  • Handover includes the plugin source, installation and configuration notes, and a list of cron jobs, queues and credentials it needs.
  • Documentation covers how to repeat the install after a Mautic upgrade, including the checks to run before and after it.
  • Your team receives a walkthrough of the code paths and failure modes so internal engineers can maintain the plugin.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, covering the plugin across future Mautic releases.
  • Retainer work can include retesting the plugin when a new Mautic minor or major release is adopted.
  • Confirm with DeployOpen how support requests, response expectations and change control are written into the retainer terms.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.