Make Your Own Plugin, Part 2: Packaging and Distributing

Now that you know how to create a plugin configuration file, all that's left before you can share your plugin is to package it nicely, test it, and you're good to go!

You should now have a plugin configuration file, as all the relevant PHP, JavaScript, CSS, images, and other files under the root of your plugin. Now, package your plugin as a regular ZIP archive - the only restriction here is that the configuration file install.php should be at the root of the ZIP archive.

If you're like me, and you make subtle little mistakes that make you re-generate that ZIP archive a bunch of times - and you're developing under Windows, download and use the following DOS batch script that takes care of cleaning up any SVN relics from the distribution, and packages stuff up as a ZIP archive. For this script to work, you need to have the following folder hierarchy (sample):
  • releases <- this is where the resulting ZIP will be placed
  • source <- this is the root of your plugin, with install.php underneath it
  • tools <- this is where the batch script goes
Note that you don't have to use this script at all - you can use your own. If you happen to write a script that does the same thing under Linux / MacOS, please share it with the community!

After you're done, test the plugin on your own installation - navigate to the Plugin Manager and try uploading your resulting ZIP archive. You should see all the metadata you've put in when you defined your plugin; if all is well, press the Install button and carefully inspect the installation log. Were all the files copied appropriately, as you'd expect them to? Are all the class files included? Are all the examples hooked up? If so, press Continue and put your plugin to a real test - run one of the examples that you've thoughtfully included for the community. Do they work? Cool!

Now, the last test: try uninstalling the plugin through the Plugin Manager. Were all the files deleted appropriately? Great. Now install it again, for the last time, as the last precaution. Still works? You're ready to share your plugin with the community!

Put your plugin ZIP file - and, ideally, the source code - somewhere where the community can download it. A great place is the QCubed Subversion /plugins directory. Just create a folder for your own plugin, and you're good to go. Now, go to the QCubed online plugin repository and edit it to add the info on your plugin. You can link to your plugin ZIP directly at the QCubed SVN if you're using it! You may also want to post an announcement to the QCubed forums and let the community know about your contribution.