How to create custom plugin in Mautic

Hello Developers,

Here I am going to explain about how to create a custom plugin in Mautic platform. Let me first introduce what Mautic is and why to use Mautic.

What is Mautic ?

Mautic is an open source software platform which is used to manage marketing automation such as lead generation, email marketing, automation of calls etc. If you are looking for a contribution to Mautic then here is link .

What is a custom plugin and why is it required ? ?

If you are already familiar with open source software like WordPress, Magento, Drupal, Joomla then you might know about the custom plugin concept and how it helps.

If you are new to this then, here is the answer for you.

Custom plugin is none other than extension of your core functionality of software which enables you to add extra features than existing one without overriding core files or core logic. A simpler way is Function Overriding in programming. If you have a parent class then you extend it as a child class and you can override the function of the parent class by using the same name and parameters. Exactly similar custom plugin work. Custom plugin is none other than a child class of core functionality or feature provided in code framework to extend functionality. Like shown in below image👇🏻 its getting added extension to switchboard.

How does it help ?

  • Keeping safe upgrade

Let’s jump onto the actual topic about creation of custom plugins in Mautic.

Steps for creation of custom plugin:

  • Purpose of plugin : Decide name and purpose of plugin so that you can use the same in plugin name and folder structure while creating in Mautic. If you are creating for third party integration then specify the same else if you’re extending Mautic existing functionality like adding extra UI components or customising of UI elements etc.
<?php 
namespace MauticPlugin\ExampleBundle;
use Mautic\PluginBundle\Bundle\PluginBundleBase;class ExampleBundle extends PluginBundleBase
{
}
?>
  • Create a Config folder inside ExampleBundle. Then create a file config.php inside the folder ExampleBundle->Config. Copy below code and make changes accordingly.
<?php// plugins/ExampleBundle/Config/config.phpreturn array(
'name' => 'ExampleBundle',
'description' => 'Add here description of plugin',
'author' => 'Avinash Dalvi', // Change this to plugin author
'version' => '1.0.0', // Change this version to your appropriate version
'routes' => array(
)
);
  • Folder structure will look like below. Other folders are as per customisation which you would like to do.
  • For the icon of the plugin keep the icon image in either .png or .jpeg format under Assets/img if the folder is not there then create an Assets/img folder and copy the image file there.

Now we are done with the creation of a custom plugin.

What are use cases where can use custom plugin :

  • Third party lead management system integration like Dialer system, Landing page form etc.

I hope this helped you in understanding how to create a custom plugin. If you have any Queries or Suggestions, feel free to reach out to me in the Comments Section below or my twitter handle @aviboy2006.

I have created one Mautic Plugin Creator. This is just bundle creation to avoid manual effort which is available on :

If you like, don’t forget to give stars.

References :

Originally published at https://www.internetkatta.com.

Enthusiastic learner, Full Stack Developer, Techno Savvy, Traveller, Out of Box thinker, Agile Lover, Problem Solver, Blogger