redaxo/source
REDAXO is a PHP-based CMS/website framework focused on flexible, module-driven content creation with full control over input/output. Multilingual, highly extendable, and workflow-friendly, with strong community resources, docs, and addons.
Installation:
git clone https://github.com/redaxo/core redaxo && cd redaxo
composer install
Use Docker for local dev:
docker-compose up -d
Access the installer at http://localhost/redaxo/install/.
First Use Case:
demo_base addon via the Addon Manager (fully English-translated demo).Key Directories:
redaxo/src/core/ – Core classes (e.g., rex_*, rex_sql_table).redaxo/src/addons/ – Bundled addons (e.g., mediapool, structure).redaxo/var/ – Runtime data (cache, logs, backups).Quick Start:
redaxo/src/addons/your_addon/.config.yml) for environment variables (e.g., !env DB_PASSWORD).Database Interactions:
rex_sql_table for table definitions (supports migrations via rex_sql).class MyTable extends rex_sql_table {
public function getTableStructure() {
return [
'id' => ['type' => 'int', 'autoinc' => true],
'title' => ['type' => 'varchar', 'length' => 255],
];
}
}
Content Management:
structure addon for nested content.
$slice = rex_slice::getCurrent();
$slice->setValue('title', 'My Content');
$slice->save();
rex_media for file uploads and MIME checks.
$media = rex_media::get($filePath);
$mime = $media->getMimeType(); // Supports `csv`, `html`, `json`, etc.
Event System:
MEDIA_LIST_QUERY) via rex_extension_point.
rex_extension_point::register('MEDIA_LIST_QUERY', function($params) {
$params['query']->where('type', 'image');
return $params;
});
CLI Automation:
user:list).
php redaxo/cli.php user:list
Frontend Integration:
rex_template).
$template = rex_template::get('my_template');
$template->setVar('content', $myData);
$template->parse();
rex_addon::get() to access addon metadata.rex_i18n:
rex_i18n::setLanguage('en');
echo rex_i18n::msg('my_addon', 'greeting');
rex_escape:
echo rex_escape($userInput);
rex_auth for role-based access:
if (rex_auth::isUserInRole('editor')) { ... }
PHP 8.3+ Requirement:
rex_editor in PHP 8.5) may trigger warnings. Update dependencies or patch core classes.rex_editor:
if (version_compare(PHP_VERSION, '8.5.0') >= 0) {
// Use alternative editor or suppress deprecations
}
Database Compatibility:
rex_sql_table normalizes TEXT defaults for MariaDB/MySQL. Test migrations in both environments.Pdo\Mysql for PHP 8.5+ compatibility:
$db = rex_sql::factory('Pdo\Mysql');
Event System Quirks:
MEDIA_LIST_QUERY: Triggered for both list and count queries in paginated results (since v5.21.0).SLICE_BE_PREVIEW: Passes the slice revision as a parameter:
rex_extension_point::register('SLICE_BE_PREVIEW', function($slice, $revision) { ... });
Session Handling:
rex_session::extendSession();
Addon Updates:
Error Handling:
rex_error::setHandler(new \Whoops\Run());
redaxo/var/log/ for runtime logs.SQL Debugging:
rex_sql::setDebug(true);
Extension Points:
php redaxo/cli.php rex:extension_points:list
Performance:
rex_sql queries:
$cache = rex_cache::factory('my_cache_key', 3600);
if (!$cache->isValid()) {
$data = rex_sql::factory()->getAll(...);
$cache->set($data);
}
Customize Media MIME Types:
rex_file::getMimeType() by overriding the mediapool addon’s allowed types:
rex_extension_point::register('MEDIA_ALLOWED_TYPES', function($types) {
$types[] = 'webp';
return $types;
});
Modify Backup Behavior:
BACKUP_PRE to add custom files:
rex_extension_point::register('BACKUP_PRE', function($backup) {
$backup->addFile('custom/path/file.sql');
});
Override Templates:
redaxo/var/templates/ and modifying.Console Commands:
redaxo/src/addons/your_addon/cli/:
namespace YourAddon\Cli;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class MyCommand extends Command {
protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('Hello from REDAXO!');
}
}
How can I help you explore Laravel packages today?