| src | initial commit | |
| .gitignore | initial commit | |
| build.php | initial commit | |
| Digitigrade_PluginMetadata.php | initial commit | |
| LICENSE | initial commit | |
| metadata.ini | initial commit | |
| README.md | initial commit | |
| stub.php.in | initial commit | |
Template Digitigrade plugin
This is an implementation of a basic plugin for
Digitigrade. As an example, it adds
a new route handler for /hello-world and uses an autoloaded class to provide
the text shown on that page. This is almost certainly not what you want your
own plugin to do, but hopefully it provides a good starting point.
Building and usage
Running ./build.php (or php build.php) will generate a plugin phar file
based on the sources in src/ and the metadata in metadata.ini. You can then
distribute this file or put it in your Digitigrade installation's plugins
folder. As an additional feature, the template includes a simple executable
phar stub that outputs the plugin's metadata, so you can "run" the plugin with
PHP to remind yourself what it is if needed.
General guidelines
When creating your plugin, please try to do the following:
- Put your classes in the namespace
Digitigrade\Plugin\<your plugin name> - Don't do too much in your entrypoint, if you have one - it will be executed whenever the plugin is loaded, which in practice means at the start of every request
- Make use of existing frameworks in Digitigrade (such as the policy system) where possible, rather than implementing your own