Metainformationen zur Seite
PHP - Develop plugins with PHP
Although Perl is the "mother" of LoxBerry - because LoxBerry's father, Michael Schlenstedt, founder of the LoxBerry project, learned this programming language during his studies a long time ago and is now too old to learn something new - there were requests of the developer community to get native PHP plugins available to LoxBerry.
LoxBerry welcomes PHP!
Search PHP LoxBerry SDK only
We've improved LoxBerry to support native PHP plugins and we have build a LoxBerry PHP SDK to get it done very simple. As LoxBerry's system functions will stay in Perl, Perl will be the leading trail. The PHP SDK follows the functions and functionality of the Perl SDK and, for plugins, it's now 99,9% feature compatible (see Module Comparison Perl vs. PHP).
For some re-occuring tasks, and frequently needed data, we have developed LoxBerry PHP modules to simplify creating plugins. These modules are called loxberry_system.php and loxberry_web.php and can be included by
require_once "loxberry_system.php" and
If you love Perl (who don't!?!), switch to the Perl SDK - Perl - Develop plugins with Perl.
Aspects creating plugins
There are several aspects you have to consider creating plugins:
- The directory layout and content of your plugin (Plugin für den Loxberry entwickeln (Version 1.x)) (German only)
- Be as system independent as possible (use the apt feature of the Plugin Interface to install binaries - don't ship compiled binaries as the won't run on other architectures)
- If you need paths inside your plugin, use the provided global variables from loxberry_system.php. Don't hard-code any system paths.
- Multilingual support - LoxBerry comes with a multilingual approach with ini-styled language files. All supporting features of loxberry_web.php directly use your multi-lang files to provide you an array with the appropriate language. Use it, it makes you and your users happy.
- LoxBerry gives you lot of freedom of permissions - don't misuse them. Do not change major system settings that are unrecoverable. Don't unfasten restrictions or permissions more than your plugin needs. Keep your changes undo-able for the situation where your plugin is uninstalled.
See these easy examples what the LoxBerry PHP SDK can do for you: