PHP - Develop plugins with PHP

PHP 8.x compatibility

Make sure to test your plugin with PHP 8.x! LoxBerry will switch from PHP 7.4 (current standard) to PHP 8.x with the next stable Debian release (Debian 13, Codename Trixie)! Here are some instructions on how to test your plugin: Testing your Plugin with PHP8.x

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 require_once "loxberry_web.php".

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.

Let's go!

See these easy examples what the LoxBerry PHP SDK can do for you:

PHP functions to create your webpage with LoxBerry design

PHP LoxBerry SDK Documentation

Writing ini files in PHP