Light-weight, fast, simple and powerful!
Translations of this page?:

Plugin Anatomy

If you have taken a look at some of the built-in plugins, you may notice they have a handful of files and may have 1 or more sub-directories in it.
Chances are, they will differ quite a bit from the contents of each file to the names and the number of folders the plugin contains.

So the first question that surely comes to mind is ”Where do I start?”.

Well, my answer is to start with the Skeleton Plugin, which is a bare-bones plugin structure included with Wolf as a template to start writing a plugin.

The Files

These files are for reference and you can have additional files or fewer files if necessary.

index.php - This file identifies your plugin with Wolf and provides information about it.
You also specify any Observers here and add the controller to Wolf using Plugin::addController() method. See index.php for more information.

SkeletonController.php - This is where all requests to your plugin get directed to the proper views. This is where you will make your database queries and logic at and then pass the data to your view. See SkeletonController.php for more details.

enable.php (optional) - The enable file is used to run code whenever the plugin is enabled in the Administration area. This could be something like creating database tables if they don't exist (such as installing the plugin) or anything else that needs to happen whenever it is enabled. See enable.php for more info.

disable.php (optional) - This is used to run any code whenever the plugin is disabled in the Administration area. This is rarely used, but there if you need it.

uninstall.php (optional) - Used to run any scripts when un-installing your plugin. This would be used for cleaning up database tables, cache files, etc.

readme.txt (optional) - This is for describing any necessary steps, requirements, or additional information about your plugin.

tutorials/plugin_anatomy.txt · Last modified: 2012-03-14 12:00 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 / design by yello studio / Wolf CMS Inside