Basic file structure of a plugin

From PHPDevShell

Jump to: navigation, search

(written on July 6, 2009 for version 2.7.0)

A plugin for PHPDevShell is basically a folder of scripts, with a few extra files for management. This folder has the name of the plugin, and goes into the "plugins" folder of your PHPDS installation. Nothing is mandatory, you can have only one script in your plugin. Even the xml config file is optional - it is needed only if you wish to enable easy installing and upgrading of your plugins. PHPDevShell maintains a standard approach to a plugin, it uses this default file structure for any plugin including itself:

- root [phpdevshell installation folder]
-    - plugins [phpdevshell plugin folder]
-    -    - pluginName [folder]       [Your Plugin Name and Folder where plugin exists]
-    -    -    - ajax [folder]        [If your plugin will be using ajax, all ajax scripts are supposed to be here.]
-    -    -    - config [folder]      [Contains the config file for your phpdevshell plugin of pluginName]
-    -    -    -    - plugin.config.xml [file] [The actual config file for your phpdevshell plugin (containing installation settings).]
-    -    -    - hooks [folder]       [All hook scripts that plugs into host plugin scripts is located here.]
-    -    -    - images [folder]      [All images will be stored here, including control panel images.]
-    -    -    - includes [folder]    [Extra classes will be stored here for my plugin.]
-    -    -    - language [folder]    [All language related files is stored here that makes it possible for others to translate your application.]
-    -    -    -    - menu.lang.php [file] [Contains default language strings for menu items.]
-    -    -    -    - plugin.lang.php [file] [Contains default language strings for plugin.]

Since version 2.8.0 an example "skeleton" plugin is included within PHPDevShell for you to use. This skeleton plugin can be found in the /phpdsroot/plugins/Skeleton directory. You can simple create a copy of this plugin and place it within it's own folder under the /plugins directory. If you do not have the Skeleton plugin, then follow instructions below to create your own plugin from scratch.

If you do not have the Skeleton plugin, create the directory structure shown above. If we want to make a full-featured plugin, the first thing we should do is start with our plugin.config.xml file. This will tell the plugin manager how to behave with installing your plugin. Or else we can just start coding our first script with Getting Started. Please see the demo plugins (shipped with the distribution) for a structure example.