Demo setup of Silex server (PHP) with module structure and demo viewer.
This demo is based on the Silex Skeleton.
- Templates are moved to
src/
following common Voorhoede module setup. - Multi-language stub support by adding
.{lang}.stub.json
files next to view templates.
The application is composed out of small single-purpose modules (e.g. app-header, breadcrumb).
Each module consists of its own template (module.html
) and a demo for variations of this template (module.demo.html
).
In addition a module can have its own presentation (module.css
), behaviour (module.js
) and other module files.
The modules are grouped into areas (blog, core, gallery, ...).
Each area has it's own routes (area/router.js
), views (area/*.html
) and can have its own assets and other specific files.
Finally the entire server is configured in /index.js
.
Resulting in the following structure:
src/
├── app.php <-- Silex app
├── controllers.php <-- shared routes
├── index.html <-- home page template
|
└── area-name/ <-- eg. blog, core, gallery
├── area-name.php <-- routes for this area
├── index.html <-- area overview template
├── item.html <-- item template
|
└── module-name/
├── module-name.html <-- module template
├── module-name.demo.html <-- demos of template variations
├── module-name.(css|js|..) <-- other module specific files
└── README.md <-- documentation with instructions
web/
├── index.php <-- front-end controller production
└── index_dev.php <-- front-end controller development
This project requires PHP (>= 5.5.9) and Composer to be installed. Then install dependencies:
composer install
COMPOSER_PROCESS_TIMEOUT=0 composer run
Then, browse to http://localhost:8888/index.php/ (production mode) or http://localhost:8888/index_dev.php/ (development mode).