Removing Craft CMS plugins that you can’t uninstall
I was recently updating my site and decided to use Michael Rog’s Wordsmith plugin for some text manipulation. His Wordsmith plugin included some features that I liked that my own custom plugin, a simple port of Hacksaw, didn’t include. I had created this plugin when Craft 3 was early in development, a time when there were many fewer plugins available and no plugin store at all.
Installing plugins through Craft 3’s Plugin Store makes things very easy. Uninstalling plugins is also very easy. As you can see by the screenshot above, the Pic Puller plugin has a convenient uninstall option in the control panel.
But, my custom “hacksaw” plug-in does not have an uninstall option. At first glance I wondered how to get rid of this custom plugin. It occurred to me I would uninstall it the same way I had installed this custom plug-in. Composer.
A quick refresher
I’ve got this custom plugin built on my local machine. It lives in a directory called local-plugins/hacksaw
in the base directory for my site, right next to the config
, src
, and web
directories.
In my site’s composer.json
file, I have told composer to look in this directory when installing plugins via the command line. In my case, my composer.json
contains this:
"repositories": [
{
"type": "path",
"url": "local-plugins/hacksaw/"
}
]
That allowed me to install my local plugin, which is identified in its own composer.json file by the name of “jmx2hacksaw/hacksaw”, by using this command:
composer require jmx2hacksaw/hacksaw
Uninstalling
Now that I don’t need this local plugin anymore, getting rid of it is basically undoing my require
command:
composer remove jmx2hacksaw/hacksaw
The local plugin is now removed.