Installation
composer create-project redaxo/project my-redaxo-project
my-redaxo-project and run:
composer install
First Use Case: Basic Page Creation
/redaxo/ (default path)./templates/).Key Directories to Explore
/core/ – REDAXO core files (avoid modifying directly)./templates/ – Override default templates here./plugins/ – Install or develop custom plugins./lib/ – Custom libraries (e.g., helpers, utilities)./config/ – Configuration files (e.g., config.php, config.yml).Scaffold a Plugin
php redaxo.php plugin:create my_plugin
my_plugin.php – Main plugin class (hooks, permissions)./templates/ – Plugin-specific templates./lib/ – Custom logic.Hooks and Events
// In my_plugin.php
public static function onGetPage($page) {
$page['content'] .= '<div>Custom content via hook</div>';
return $page;
}
my_plugin.php:
public static function onInstall() {
self::registerHook('getPage', 'onGetPage');
}
YAML Configuration
/config.yml:
name: My Plugin
version: 1.0.0
author: Your Name
permissions:
- my_plugin_edit
Frontend Integration
rex_view to render templates:
rex_view::output('my_plugin/template.tpl', ['data' => $data]);
rex_request() or rex_db.Override Default Templates
/core/templates/ files to /templates/ (e.g., page.tpl).Dynamic Content with rex_yaml_parser
$content = rex_yaml_parser::parse($page['content']);
// Manipulate $content array, then re-render:
$page['content'] = rex_yaml_parser::toString($content);
CSS/JS Assets
/files/ (e.g., /files/css/my_style.css).<link rel="stylesheet" href="{$rex['baseUrl']}files/css/my_style.css">
rex_db for Queries
$articles = rex_db::factory()->getTable('rex_article')->where(['active' => 1])->findAll();
rex_sql for schema changes:
rex_sql::factory()->setQuery('ALTER TABLE rex_article ADD COLUMN custom_field VARCHAR(255)');
rex_sql::factory()->exec();
Core File Modifications
/core/ directly. Use plugins or template overrides./core/config.php for global settings (e.g., debug mode).Caching Quirks
php redaxo.php cache:clear
rex_cache to invalidate specific caches:
rex_cache::set('my_cache_key', $data, ['lifetime' => 3600]);
Plugin Dependencies
requires in config.yml).php redaxo.php plugin:list
YAML Parsing Errors
config.yml or page content can break the backend.composer require --dev symfony/yaml
Then test parsing:
use Symfony\Component\Yaml\Yaml;
$config = Yaml::parseFile('/path/to/config.yml');
Enable Debug Mode
/config/config.php:
$INSTALL['debug'] = true;
/log/.Use rex_error for Logging
rex_error::message('Debug message', 'my_plugin');
Database Debugging
config.php:
$INSTALL['sql_debug'] = true;
/log/sql.log for queries.Frontend Debugging
rex_view::debug() to dump template variables:
rex_view::debug($data);
Custom Admin Modules
class my_module extends rex_module {
public function run() {
$this->addCssFile('my_module.css');
$this->addJsFile('my_module.js');
$this->includeTemplate('my_module.tpl');
}
}
API Endpoints
public static function onGetPage($page) {
if (rex_request::cget('api') === 'my_endpoint') {
return json_encode(['data' => 'response']);
}
return $page;
}
CLI Automation
php redaxo.php my:custom_command
/plugins/my_plugin/cli.php:
rex_cli::addCommand('my:custom_command', function() {
echo "Running custom command!";
});
Multilingual Support
rex_language for translations:
$text = rex_language::getString('my_plugin::greeting');
/languages/en.yml:
greeting: "Hello, world!"
How can I help you explore Laravel packages today?