SuperGeekery: A blog probably of interest only to nerds by John F Morton.

A blog prob­a­bly of inter­est only to nerds by John F Mor­ton.

Removing Craft CMS plugins that you can’t uninstall

Removing Plugins You Cant Uninstall

I was recent­ly updat­ing my site and decid­ed to use Michael Rog’s Word­smith plu­g­in for some text manip­u­la­tion. His Word­smith plu­g­in includ­ed some fea­tures that I liked that my own cus­tom plu­g­in, a sim­ple port of Hack­saw, didn’t include. I had cre­at­ed this plu­g­in when Craft 3 was ear­ly in devel­op­ment, a time when there were many few­er plu­g­ins avail­able and no plu­g­in store at all. 

Installing plu­g­ins through Craft 3s Plu­g­in Store makes things very easy. Unin­stalling plu­g­ins is also very easy. As you can see by the screen­shot above, the Pic Puller plu­g­in has a con­ve­nient unin­stall option in the con­trol pan­el. 

But, my cus­tom hack­saw” plug-in does not have an unin­stall option. At first glance I won­dered how to get rid of this cus­tom plu­g­in. It occurred to me I would unin­stall it the same way I had installed this cus­tom plug-in. Com­pos­er.

A quick refresh­er #

I’ve got this cus­tom plu­g­in built on my local machine. It lives in a direc­to­ry called local-plugins/hacksaw in the base direc­to­ry for my site, right next to the config, src, and web direc­to­ries.

In my site’s composer.json file, I have told com­pos­er to look in this direc­to­ry when installing plu­g­ins via the com­mand line. In my case, my composer.json con­tains this:

"repositories": [
            "type": "path",
            "url": "local-plugins/hacksaw/"

That allowed me to install my local plu­g­in, which is iden­ti­fied in its own composer.json file by the name of jmx2hacksaw/​hacksaw”, by using this com­mand:

composer require jmx2hacksaw/hacksaw

Unin­stalling #

Now that I don’t need this local plu­g­in any­more, get­ting rid of it is basi­cal­ly undo­ing my require com­mand:

composer remove jmx2hacksaw/hacksaw

The local plu­g­in is now removed.