# extending mautic

**URL:** https://forum.mautic.org/t/extending-mautic/2732
**Category:** Development
**Created:** [November 8, 2015, 8:32pm UTC](https://forum.mautic.org/t/extending-mautic/2732 "2015-11-08T20:32:19Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 8, 2015, 8:32pm UTC](https://forum.mautic.org/t/extending-mautic/2732/1 "2015-11-08T20:32:19Z")

</div>

hi escopecz, please i need your help wishing not to bother you, actually i want to extend mautic by adding a topic to the list of the left pane which contains dashboard ,emails ,landing pages , campaigns… the question is how to do it , i took a look about symfony and get familiar with it, but am new to open source and don’t know how to start such thing (extending). so what is the key is it a plugin ? or something else ? i wish you tell me briefed steps about my issue and ill really appreciate it.

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 8, 2015, 8:32pm UTC](https://forum.mautic.org/t/extending-mautic/2732/2 "2015-11-08T20:32:19Z")

</div>

hi escopecz, please i need your help wishing not to bother you, actually i want to extend mautic by adding a topic to the list of the left pane which contains dashboard ,emails ,landing pages , campaigns… the question is how to do it , i took a look about symfony and get familiar with it, but am new to open source and don’t know how to start such thing (extending). so what is the key is it a plugin ? or something else ? i wish you tell me briefed steps about my issue and ill really appreciate it.

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 9, 2015, 7:42am UTC](https://forum.mautic.org/t/extending-mautic/2732/3 "2015-11-09T07:42:52Z")

</div>

Hello, that’s actually a great question. Yes, if you want to extend Mautic, go with a plugin. To compose a plugin, inspire by the existing plugins (naming convention) and the core bundles. For example this is how you create a menu item:

[https://github.com/mautic/mautic/blob/staging/app/bundles/AssetBundle/Config/config.php#L51-L63](https://github.com/mautic/mautic/blob/staging/app/bundles/AssetBundle/Config/config.php#L51-L63)

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 9, 2015, 8:16am UTC](https://forum.mautic.org/t/extending-mautic/2732/4 "2015-11-09T08:16:16Z")

</div>

ok thanks for the hint 🙂 just another question . i read about the mautic bundle generator . i download it (zip file) but dont know how to make it work. does it works ? generate a full bundle ? or should i write the plugin manually word by word ?

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 9, 2015, 8:49am UTC](https://forum.mautic.org/t/extending-mautic/2732/5 "2015-11-09T08:49:13Z")

</div>

I haven’t heard about a Mautic bundle generator actually. So I can’t help with that.

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 9, 2015, 1:04pm UTC](https://forum.mautic.org/t/extending-mautic/2732/6 "2015-11-09T13:04:11Z")

</div>

actually i made a sample plugin to test it and place it in the plugins folder . then i tried to press install plugin from the plugin manager but i get ( 0 plugins installed …) could you help me just to get started not more . i don’t know why my plugins didn’t get installed.

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 9, 2015, 1:14pm UTC](https://forum.mautic.org/t/extending-mautic/2732/7 "2015-11-09T13:14:28Z")

</div>

The first thing to do when something is behaving funny during Mautic development: clear the cache. There is a command for it. Read about it here:  
[https://developer.mautic.org/#development-environment](https://developer.mautic.org/#development-environment)

If your plugin is not installed, and the cache is cleared, it has probably some naming convention broken. Hard to say where or what is it. The best would be if you’ll link here a Github repo where I could see the code. Also, it’s pity we are discussing it in a private thread and it won’t help anyone else.

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 10, 2015, 12:20pm UTC](https://forum.mautic.org/t/extending-mautic/2732/8 "2015-11-10T12:20:34Z")

</div>

actually i have prod cache in my app i already delete it but with no results . this is the sample plugin i did, please check it for me  
[https://drive.google.com/open?id=0By1rOlT63sKGc0lDNTRmdV96UXM](https://drive.google.com/open?id=0By1rOlT63sKGc0lDNTRmdV96UXM)

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 10, 2015, 12:26pm UTC](https://forum.mautic.org/t/extending-mautic/2732/9 "2015-11-10T12:26:54Z")

</div>

Try to implement these values to your config.php:

[https://github.com/mautic/mautic/blob/staging/plugins/MauticCrmBundle/Config/config.php](https://github.com/mautic/mautic/blob/staging/plugins/MauticCrmBundle/Config/config.php)

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 10, 2015, 12:52pm UTC](https://forum.mautic.org/t/extending-mautic/2732/10 "2015-11-10T12:52:08Z")

</div>

am really sorry escopecz but also it didnt work after i implement the code you sent ☹  
this is the link after i added the code : [https://drive.google.com/open?id=0By1rOlT63sKGeDVrT0pBN2NtTFU](https://drive.google.com/open?id=0By1rOlT63sKGeDVrT0pBN2NtTFU)

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 10, 2015, 1:01pm UTC](https://forum.mautic.org/t/extending-mautic/2732/11 "2015-11-10T13:01:27Z")

</div>

It works for me. Name the plugin in config.php with a unique name, clear cache and then you’ll see this:

```auto
Compile Error: Cannot redeclare class MauticMauticSocialMediaBundleControllerDefaultController
```

Rename your controller name to some unique name and you’ll be able to install the plugin.

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 10, 2015, 1:49pm UTC](https://forum.mautic.org/t/extending-mautic/2732/12 "2015-11-10T13:49:54Z")

</div>

actually i delete the prod cache manually not by command and there is no dev cache to delete it. still not working and am stuck can i let you connect my server via team viewer to check the plugin folder ? dont want to be rude but am really in need to it in my work escopecz

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 10, 2015, 1:56pm UTC](https://forum.mautic.org/t/extending-mautic/2732/13 "2015-11-10T13:56:03Z")

</div>

I also don’t want to be rude, but I don’t provide such level of support. I don’t even work on Mautic today but on another project.

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 10, 2015, 2:06pm UTC](https://forum.mautic.org/t/extending-mautic/2732/14 "2015-11-10T14:06:18Z")

</div>

ah ok bro dont mind you helped me alot am really thankfull bro , one last thing please can u check my folder finally is there any mistake ? i changed the plugin name in config.php and the controller name. and does it matter if i deleted the cache manually or by command ?? this is the last update : [https://drive.google.com/open?id=0By1rOlT63sKGLTJwNzdQbVJiVUU](https://drive.google.com/open?id=0By1rOlT63sKGLTJwNzdQbVJiVUU)

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 10, 2015, 2:14pm UTC](https://forum.mautic.org/t/extending-mautic/2732/15 "2015-11-10T14:14:58Z")

</div>

Now I’m getting

```auto
Runtime Notice: Declaration of MauticPluginMauticSocialMediaBundleMauticSocialMediaBundle::onPluginInstall() should be compatible with MauticPluginBundleBundlePluginBundleBase::onPluginInstall(MauticPluginBundleEntityPlugin $plugin, MauticCoreBundleFactoryMauticFactory $factory, $metadata = NULL)
```

You probably don’t use dev environment if the dev cache is not generated. Read [https://developer.mautic.org/#development-environment](https://developer.mautic.org/#development-environment)

There is almost no difference if you use the command or just remove the directory. The command also generates the new cache, but cache is also generated automatically on refresh so the result is the same.

Good luck with your plugin. I hope you’ll help us write some better docs from your experience. It’d help others a lot.

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 10, 2015, 2:21pm UTC](https://forum.mautic.org/t/extending-mautic/2732/16 "2015-11-10T14:21:23Z")

</div>

am thankful bro , i really appreciate it . bubye

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 12, 2015, 10:43am UTC](https://forum.mautic.org/t/extending-mautic/2732/17 "2015-11-12T10:43:28Z")

</div>

hi again escopecz, please wanna ask you something , i tried my plugin in the dev mode and i got the error you told me before. so am not able to enter the dev mode again due to the error which my plugin did, how can i fix that to enter the dev mode again ?

---

<div class="post-metadata">

### Author: ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)
#### Post date: [November 12, 2015, 11:04am UTC](https://forum.mautic.org/t/extending-mautic/2732/18 "2015-11-12T11:04:52Z")

</div>

Heh, this is going to be a long development if we’ll consult every error message. Let’s look at what the error message says in more detail:

This is where the problem is:

```auto
Declaration of MauticPluginMauticSocialMediaBundleMauticSocialMediaBundle::onPluginInstall()
```

This is how PHP is suggesting to fix it:

```auto
should be compatible with MauticPluginBundleBundlePluginBundleBase::onPluginInstall(MauticPluginBundleEntityPlugin $plugin, MauticCoreBundleFactoryMauticFactory $factory, $metadata = NULL)
```

Your onPluginInstall method looks like this:

[code]static public function onPluginInstall(Plugin $plugin, MauticFactory $factory, $metadata = null)  
{  
if ($metadata !== null) {  
self::installPluginSchema($metadata, $factory);  
}

```
    // Do other install stuff
}[/code]

```

There is no use statement for

```auto
MauticPluginBundleEntityPlugin
```

and

```auto
MauticCoreBundleFactoryMauticFactory
```

so what PHP is ranting about is that the method in the parent class (MauticPluginBundleBundlePluginBundleBase::onPluginInstall) has 2 parameters which types are not the same as your onPluginInstall method has.

So the solution would be to add the use statements with those classes so the parameter types will be the same. But this is just my guess. I didn’t test it.

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 12, 2015, 11:29am UTC](https://forum.mautic.org/t/extending-mautic/2732/19 "2015-11-12T11:29:18Z")

</div>

am really sorry if iam taking alot of ur time thank u bro and you were right i put the use statements for install and update and the error is gone but the plugin did nothing and the topic to the left pane is not added :s

---

<div class="post-metadata">

### Author: ![fadelle](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@fadelle](https://forum.mautic.org/u/fadelle)
#### Post date: [November 18, 2015, 9:58am UTC](https://forum.mautic.org/t/extending-mautic/2732/20 "2015-11-18T09:58:35Z")

</div>

hi escopecz i know you didnt miss me 🙂 but i do , just a typical question i changed something in my plugin and in the prod mode it is working fine while in the dev mode it is not responding even deleting the cache didnt solve the problem. any idea bro ?

[Next page](https://forum.mautic.org/t/extending-mautic/2732.md?page=2)
