Mautic Developer Documentation

Development Environment

  • Development environment
  • How to install Mautic with DDEV
  • How to install Mautic manually
  • Environments

Design and UX

  • Depicting availability of interface elements
  • Displaying elements based on User permissions
  • Providing effective user feedback
  • Guidelines for labelling the Mautic interface
  • Notifications
  • Implementing flash messages
  • Quick filters for searches
  • Retrieving Mautic settings in Twig
  • Utilities

Design templates

  • Accordion component
  • ProTip template to enhancing user experience
  • Using the Tile Component

Themes

  • Getting started with Themes
  • GrapesJS Builder
  • Legacy Builder
  • Customizing Forms
  • Overriding core view templates

Form Hooks

  • Getting started with Form hooks
  • General hooks
  • Validation hooks
  • Response hooks

Webhooks

  • Getting started with Webhooks
  • Webhook example scripts
  • Webhook events and payloads

Mautic Marketplace

  • Marketplace
  • Listing a Plugin in the Marketplace
  • Allow list: what is it and why is it needed?
  • Best practices

Plugins

  • Getting started with Plugins
  • Autowiring
  • Deviations from the standard Symfony Framework
  • Plugin dependencies
  • File and directory structure
  • Config file
  • Event listeners
  • Installing, upgrading, and uninstalling
  • Entities and schema
  • Cache
  • Translating Plugins
  • Continuous Integration
  • Update Plugins for Mautic 5
  • Model-View-Controller - MVC
  • Roles and permissions

Plugin Extensions

  • Manipulating Contacts
  • API
  • Campaigns
  • Categories
  • Channels
  • Contacts
  • Emails
  • Forms
  • Forms - advanced
  • Integrations
  • Landing pages
  • Maintenance cleanup
  • Points
  • Reports
  • UI - User Interface
  • Webhooks

Plugin Integrations

  • Getting started with Integrations

Plugin Services

  • Cookie helper
    • Using the helper
    • Cookie methods
  • Database or entity manager
  • Event dispatcher
  • Factory
  • IP lookup services
  • Mail helper
  • Model factory
  • Config parameters
  • Paths helper
  • Plugin config helper
  • Request
  • Router
  • Security
  • Session
  • Translator
  • User

Miscellaneous

  • Commands
  • Events
  • Flash messages
  • Forms
  • Helpers
  • Implementing translation support to entities
  • Implementing variant - A/B test - support to entities

REST API

  • Getting started with REST API
  • Mautic API v2
  • Authentication
  • Assets
  • Campaigns
  • Categories
  • Companies
  • Contacts
  • Dashboard widget data
  • Dynamic Content
  • Emails
  • Fields
  • Files
  • Focus
  • Forms
  • Marketing Messages
  • Notes
  • Notifications
  • Pages
  • Point Actions
  • Point Groups
  • Point Triggers
  • Reports
  • Roles
  • Segments
  • Stages
  • Stats
  • Tags
  • Text messages
  • Themes
  • Tweets
  • Users
  • Webhooks

MauticJS API

  • Tracking script MauticJS (mtc.js)

Testing

  • End to end test suite
Mautic Developer Documentation
  • Cookie helper
  • Edit on GitHub

Cookie helper

The Cookie helper lets Plugins read request cookies and queue response cookies while reusing Mautic cookie defaults - path, domain, secure, and HTTP-only.

Using the helper

Inject Mautic\CoreBundle\Helper\CookieHelper into your service, or retrieve it from the container in legacy code.

<?php

use Mautic\CoreBundle\Helper\CookieHelper;

final class ExampleService
{
    public function __construct(private CookieHelper $cookieHelper)
    {
    }

    public function handleCookie(): void
    {
        // Set a cookie that expires in 1 hour (3600 seconds)
        $this->cookieHelper->setCookie('example_cookie', 'example_value', 3600);

        // Read a cookie value with fallback
        $value = $this->cookieHelper->getCookie('example_cookie', 'default_value');

        // Remove the cookie
        $this->cookieHelper->deleteCookie('example_cookie');
    }
}

Cookie methods

The helper exposes these main methods:

  • getCookie(string $key, $default = null): reads a cookie from the current request.

  • setCookie(string $name, $value, ?int $expire = 1800, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httpOnly = null, ?string $sameSite = Cookie::SAMESITE_LAX): queues a cookie on the response.

  • deleteCookie(string $name, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httpOnly = null, ?string $sameSite = Cookie::SAMESITE_LAX): expires a cookie.

If you omit optional arguments in setCookie() and deleteCookie(), Mautic uses configured defaults.

Tip

Use Cookie::SAMESITE_STRICT or Cookie::SAMESITE_NONE when your Plugin requires explicit SameSite behavior.

Previous Next

© Copyright 2021, Mautic contributors.

Built with Sphinx using a theme provided by Read the Docs.