PHP Classes

Need some help creating my custom installer

Recommend this page to a friend!

      PHP Composer Asset Manager  >  PHP Composer Asset Manager package blog  >  Using Composer to Ins...  >  All threads  >  Need some help creating my custom...  >  (Un) Subscribe thread alerts  
Subject:Need some help creating my custom...
Summary:This is the first time I've created a plugin
Author:Frog warrior
Date:2014-08-27 17:45:08

  1. Need some help creating my custom...   Reply   Report abuse  
Picture of Frog warrior Frog warrior - 2014-08-27 17:45:08
I've been reading up on custom installers and plugins on the composer docs, but I'm not sure whether I need to make a whole new plugin, or just add my own installer class to the mlemos/Composer directory. I haven't quite got my head around namespaces yet, but I have a general idea. I just need a bit more info on how to create this particular custom installer. I've wanted to make my own installers for WordPress and frameworks like CakePHP but never got round to it. I notice that many composer.json files call installer methods directory in a format that looks like a namespace, like this:

"scripts": {
"post-install-cmd": "Wordpress\\Composer\\InstallerTasks::wpConfig"

that particular installer lets you automatically edit the wp-config file, but I don't quite understand all these back slashes. The only installer plugin I can see installed in that file is this:

"type": "vcs",
"url": ""

so I don't understand the path thing, my installation has no Wordpress/Composer directory, it only has composer directories inside plugin folder. Can I just add a file with an installer class to a pre-existing folder, and call it like that? Any additional info would be greatly appreciated. If I figure it out myself, I'll help improve the docs so less experienced users can follow the instructions.