Integration with Other Systems
Sometimes we need to integrate the Festi Framework with other systems, frameworks, or platforms. For example, WordPress, Laravel etc.
WordPress
WordPress is typically integrated for plugin development. To do this, you need to add two constants in the main plugin file:
define('FESTI_CORE_PATH', 'PATH_TO_FRAMEWORK_FOLDER');
define('ENGINE_BASE_PATH', __DIR__.DIRECTORY_SEPARATOR);
FESTI_CORE_PATH
- path to the framework folder;ENGINE_BASE_PATH
- path to the plugin folder, usually__DIR__.DIRECTORY_SEPARATOR
;
After that, you need to include and call the class responsible for WordPress compatibility:
require_once FESTI_CORE_PATH.'/tools/compatibility/FestiCoreStandalone.php';
FestiCoreStandalone::init();
Now the framework works in Standalone mode, which allows you to use the functionality of framework plugins and storage (which is very convenient for WordPress plugins).
To launch the framework fully on top of WordPress, you need to select a page for the entry point and call:
FestiCoreStandalone::bind();
To install the system on top of WordPress, you need to call in the register_activation_hook
hook:
FestiCoreStandalone::install();
Examples
In a WordPress plugin, you can place an XML file in the tblDefs
folder at the root and call the storage work:
$core = Core::getInstance();
$store = $core->createStoreInstance("XML_NAME");
$response = new Response();
$store->onRequest($response);
$response->send();
You can call framework plugin methods from inside a WordPress plugin:
$plugin = $core->getPluginInstance('YOUR_PLUGIN_NAME');
$plugin->yourMethod();
$response = new Response();
$plugin->onDisplayDefault($response);
$response->send();
Using Compatibility Wrapper Package
The Festi Compatibility Wrapper provides a more organized approach to integrating the Festi Framework with other systems like WordPress.
Installation via Composer
To install via Composer, add the following to your composer.json
:
{
"repositories": [
{
"type": "composer",
"url": "https://packages.festi.io/"
}
],
"require": {
"festi-team/frameworks-compatibility-wrapper": "dev-master"
}
}
Features
- Engine Compatibility Layer – Abstracts framework-specific implementations.
- WordPress Integration – Bridges WordPress with Festi Framework.
- Standalone Mode – Runs Festi independently without requiring a full framework.
- User Management Bridge – Syncs users across platforms.
Usage with FestiCoreStandalone
Initialization
Before using any compatibility features, you need to initialize the compatibility layer:
FestiCoreStandalone::init($options);
The $options
array can be used to configure various aspects of the framework integration.
Checking Initialization Status
You can check if the compatibility layer has been initialized:
if (FestiCoreStandalone::isInit()) {
// The compatibility layer is ready
}
Installation
To install the framework within the WordPress environment:
FestiCoreStandalone::install($options);
This will set up necessary database tables and configurations.
Binding to WordPress
To integrate the framework with WordPress for handling requests:
FestiCoreStandalone::bind($options);
The $options
array can include:
- system_plugin
- Name of the system plugin to use (defaults to "Jimbo")
WordPress User Bridge
The compatibility layer includes a WordPress user bridge that maps WordPress users to Festi Framework user roles:
- WordPress administrators are mapped to
TYPE_ADMIN
(1) - Regular WordPress users are mapped to
TYPE_USER
(2) - Non-logged in users are mapped to
TYPE_ANONYM
This allows your application to use WordPress authentication while maintaining Festi's user role management.