dressapi / cms
DressAPI CMS - Content Management System built on DressAPI Core.
Requires
- php: >=8.1
- dressapi/core: ^3.0.8
README
DressAPI CMS is a server-side content management system built on DressAPI Core. It extends the core REST API framework with HTML rendering, a template engine, a plugin system, and support for two CSS frameworks: Bootstrap 5 and Bootstrap Italia 5 (the design system of the Italian Public Administration).
License: Apache 2.0 · Author: Tufano Pasquale · Version: 3.0.6
What DressAPI CMS adds to Core
| Feature | Description |
|---|---|
| HTML rendering | Server-side page generation via CHtmlResponse |
| Template engine | .tmpl.php templates with variables, loops and conditionals |
| Plugin system | Per-module overrides in plugins/ without touching core code |
Bootstrap 5 (b5) | Standard Bootstrap 5 UI components |
Bootstrap Italia 5 (bi5) | Italian PA design system UI components |
| Session authentication | Cookie-based sessions for browser navigation (in addition to JWT) |
| Multilingual content | Per-record language variants and UI string translations |
| CMS pages and menu | Built-in modules for pages and navigation management |
Requirements
| Component | Minimum | Notes |
|---|---|---|
| PHP | 8.1 | Extensions: pdo_mysql, curl, mbstring, json |
| MySQL | 5.7 | Or MariaDB >= 10.3 |
| Apache | 2.4 | mod_rewrite, mod_ssl, mod_headers required |
| Composer | 2.x |
Installation
Via Composer
composer require dressapi/cms
Via Git
git clone https://git.dressapi.com/dressapi/cms.git
cd cms
composer install
composer install downloads dressapi/core and all other dependencies automatically.
Configuration
Copy config.php.sample to config.php and edit:
<?php
define('DOMAIN_NAME', 'yourdomain.com');
define('APP_NAME', 'myapp');
define('APP_ENV', 'production'); // develop | stage | production
// CSS framework: 'b5' = Bootstrap 5, 'bi5' = Bootstrap Italia 5
define('CURRENT_VIEW_FOLDER', 'b5');
// IMPORTANT: change before going to production
define('TOKEN_SECRET_KEY', 'your-unique-jwt-secret');
define('PWD_CRYPT', 'your-unique-crypt-key');
// Database
define('DB_HOST', 'localhost');
define('DB_PORT', 3306);
define('DB_NAME', 'mydb');
define('DB_USERNAME', 'myuser');
define('DB_PASSWORD', 'mypassword');
// Languages (optional)
define('LANGUAGE_MULTI_CONTENTS', true);
define('LANGUAGES', ['EN', 'IT']);
define('DEFAULT_LANGUAGE', 'EN');
Database Setup
# Create database
mysql -u root -p -e "CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
# Import schema (framework tables + demo data)
mysql -u root -p mydb < _SETUP/dressapi_cms.sql
Default admin credentials (change immediately in production):
| Role | Password | |
|---|---|---|
| Admin | admin@dressapi.com | admin |
Apache Configuration
sudo cp _SETUP/dressapi-cms.conf /etc/apache2/sites-available/
# Edit paths inside the file if your installation differs
sudo a2ensite dressapi-cms
sudo systemctl reload apache2
Template Engine
Templates are .tmpl.php files located in plugins/{module}/views/{framework}/page-frames/.
| Syntax | Description |
|---|---|
{{variable}} | Output a variable |
{{locals::var}} | Output a local variable |
{{ 'text' }} | Output a translatable string |
[single] ... [/single] | Block rendered once (single record) |
[multiple] ... [/multiple] | Block repeated for each record in a list |
[if-exists variable] ... [/if-exists] | Conditional block |
Plugin System
Plugins in plugins/{module}/ override the corresponding core module. The structure mirrors the core module structure:
plugins/
news/
controller/ # CNewsController.php (extends CBaseController)
model/ # CNewsModel.php (optional)
views/
b5/
page-frames/ # *.tmpl.php templates
processors/ # PreProcess.php, PostProcess.php
inline-assets/ # js/, css/
bi5/
...
To override a module, create the corresponding file in plugins/ — the framework loads it automatically.
Dependency on DressAPI API
The CMS admin interface uses DressAPI API to populate picklists (select elements for related tables). Make sure a running instance of dressapi/api is accessible and configured in your environment when using the CMS admin panel.
Related Projects
| Project | Description |
|---|---|
| dressapi/core | Framework core library |
| dressapi/api | REST API (required for picklists in CMS admin) |
License
Apache 2.0 — free for personal and commercial use.