Your software
My Mautic version is: 5.1.0
My PHP version is: 8.2.23
My Database type and version: MySQL 8.2.23
Your problem
I’m trying to create a plugin, but it’s not showing up under the “Settings → Plugins” section in Mautic.
Sample Code of the Plugin:
- Created a folder inside
plugins/DemoTestBundle
Config/config.php
:
return [
'name' => 'Si Demo',
'description' => 'Team demo creating a bootstrapped plugin',
'version' => '1.0',
'author' => 'Team demo'
];
composer.json
:
{
"name": "mautic/demotestbundle",
"description": "A plugin to build DB connections in Mautic.",
"type": "mautic-plugin",
"autoload": {
"psr-4": {
"MauticPlugin\\DemoTestBundle\\": "plugins/DemoTestBundle"
}
}
}
DemoTestBundle.php
:
namespace MauticPlugin\DemoTestBundle;
use Mautic\PluginBundle\Bundle\PluginBundleBase;
class DemoTestBundle extends PluginBundleBase
{
// Nothing more required
}
Steps I Have Tried to Fix the Problem:
- Cleared the cache in
var/cache/prod/
- Executed
composer dump-autoload
- Cleared the cache using
php bin/console cache:clear
- click on
Install / Upgrade Plugins
button at right corner in UI setting → plugin
check log we got a error
[2024-09-18T05:43:28.008033+00:00] mautic.CRITICAL: Uncaught PHP Exception TypeError: "Mautic\PluginBundle\Event\PluginUpdateEvent::__construct(): Argument #2 ($oldVersion) must be of type string, null given, called in /var/www/html/app/bundles/PluginBundle/Helper/ReloadHelper.php on line 83" at /var/www/html/app/bundles/PluginBundle/Event/PluginUpdateEvent.php line 12 {"exception":"[object] (TypeError(code: 0): Mautic\\PluginBundle\\Event\\PluginUpdateEvent::__construct(): Argument #2 ($oldVersion) must be of type string, null given, called in /var/www/html/app/bundles/PluginBundle/Helper/ReloadHelper.php on line 83 at /var/www/html/app/bundles/PluginBundle/Event/PluginUpdateEvent.php:12)
[stacktrace]
#0 /var/www/html/app/bundles/PluginBundle/Helper/ReloadHelper.php(83): Mautic\\PluginBundle\\Event\\PluginUpdateEvent->__construct()
#1 /var/www/html/app/bundles/PluginBundle/Facade/ReloadFacade.php(35): Mautic\\PluginBundle\\Helper\\ReloadHelper->updatePlugins()
#2 /var/www/html/app/bundles/PluginBundle/Controller/PluginController.php(415): Mautic\\PluginBundle\\Facade\\ReloadFacade->reloadPlugins()
#3 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(163): Mautic\\PluginBundle\\Controller\\PluginController->reloadAction()
#4 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(75): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
#5 /var/www/html/vendor/symfony/http-kernel/Kernel.php(202): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
#6 /var/www/html/app/AppKernel.php(109): Symfony\\Component\\HttpKernel\\Kernel->handle()
#7 /var/www/html/app/middlewares/CORSMiddleware.php(76): AppKernel->handle()
#8 /var/www/html/app/middlewares/HSTSMiddleware.php(39): Mautic\\Middleware\\CORSMiddleware->handle()
#9 /var/www/html/app/middlewares/CatchExceptionMiddleware.php(28): Mautic\\Middleware\\HSTSMiddleware->handle()
#10 /var/www/html/app/middlewares/VersionCheckMiddleware.php(58): Mautic\\Middleware\\CatchExceptionMiddleware->handle()
#11 /var/www/html/app/middlewares/TrustMiddleware.php(42): Mautic\\Middleware\\VersionCheckMiddleware->handle()
#12 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Mautic\\Middleware\\TrustMiddleware->handle()
#13 /var/www/html/index.php(18): Stack\\StackedHttpKernel->handle()
#14 {main}
"}
[2024-09-18T05:44:21.587888+00:00] mautic.WARNING: PHP Warning - Undefined array key "path" - in file /var/www/html/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 108
Any hints on what might be going wrong?
Kind regards,
Prince Patel