Advertisement

Create a plugin Topic is solved

For Joomla! 5.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
benyrfg
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Aug 13, 2018 12:52 pm

Create a plugin

Post by benyrfg » Wed Dec 11, 2024 6:10 pm

Hello,

I'm trying to create a simple plugin for image optimization. I followed this tutorial (https://manual.joomla.org/docs/building ... nt-plugin/) for creating plugins in the new Joomla 5 way, but I'm not able to handle with this error:

Error
Class "My\Plugin\Content\ImageOptimizer\Extension\ImageOptimizer" not found
https://ibb.co/JQWbd3J

Here is the plugin repository: https://github.com/benyrfg/imageoptimizer

Thank you for any ideas.

Advertisement
SharkyKZ
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3132
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Create a plugin

Post by SharkyKZ » Wed Dec 11, 2024 7:18 pm

Try deleting administrator/cache/autoload_psr4.php file if you created the files in existing Joomla installation. Also the plugin fails to install.

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 25344
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Create a plugin

Post by pe7er » Wed Dec 11, 2024 7:18 pm

Joomla uses the PSR-4 standard for autoloading classes.
Sometimes Class not found errors are caused by issues in the autoload_psr4.php file.

Could you try deleting the /administrator/cache/autoload_psr4.php file?
It will be recreated with the next page load.
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2965
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Create a plugin

Post by ceford » Wed Dec 11, 2024 11:08 pm

I don't know if this is the problem but I think this line in the manifest file should not be present:

Code: Select all

        <filename plugin="imageoptimizer">ImageOptimizer.php</filename>
That file is in the src/Extension folder.

benyrfg
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Aug 13, 2018 12:52 pm

Re: Create a plugin

Post by benyrfg » Thu Dec 12, 2024 6:06 pm

Thank you, deleting administrator/cache/autoload_psr4.ph helped!

Advertisement

Post Reply

Return to “Joomla! 5.x Coding”