php-lab: four PHP projects, from plain PDO to Drupal
A monorepo of small, focused exercises built around one theme: a fictional town hall (Comune di Esempio) and its public notices (avvisi). Each project shows the same ideas at a different level of abstraction, with tests, static analysis and CI.
pdo-crud
Plain PHP 8 contacts CRUD: PDO, PSR-4, enums, CSRF/XSS protection, PHPUnit.
laravel
Notices board: routes, Eloquent, Form Requests, Blade components, feature tests.
drupal10
Municipal site with Bootstrap Italia: content types, Views, custom module and theme.
wordpress
Child theme and plugin: custom post type, taxonomy, meta box, REST field, Elementor widget.
pdo-crud
A contacts manager written without a framework, to show the building blocks that frameworks are made of.
- PHP 8.2+
- PDO
- Composer PSR-4
- PHPUnit 11
- PHPStan level 8
- PSR-12
- Bootstrap 5
Highlights
- Front controller in
public/index.php: the only file the web server exposes. readonlyvalue object, backedenumwithmatch, constructor promotion, named arguments.- Repository interface with a PDO implementation using prepared statements only.
- CSRF token checked with
hash_equals; every value escaped on output. - Domain exceptions mapped to 404 / 422 responses.
Tested with
- Unit and integration tests (SQLite in memory).
- PHPStan level 8 and PHP_CodeSniffer in GitHub Actions.
laravel
A quick but complete tour of Laravel: a notices board for the town hall with CRUD, filters, validation and tests.
- Laravel 13
- PHP 8.3
- Eloquent
- Form Requests
- Blade components
- PHPUnit
Highlights
Route::resourcewith a 7-action controller and route model binding by slug.- Form Request validation with
Rule::enum; one enum shared by model, validation and views. - Model casts, scopes and model events; migrations, factories and seeders.
- Blade layout and reusable components, Bootstrap 5 without a Node build.
Tested with
- Feature tests with
RefreshDatabase. - Compare with the plain PHP version to see what the framework does for you.
drupal10
A municipal website built like the Designers Italia "modello Comuni", with a custom module and a Bootstrap Italia theme.
- Drupal 10.6
- PHP 8.3
- Drush 13
- Bootstrap Italia 2.13
- Twig
- Drupal coder
Highlights
- Content type
avvisowith a taxonomy reference (road works, events, services, emergencies). - View
/avvisiwith cards, exposed category filter and pager. - Custom module: routing, controller, services with dependency injection, config form, block plugin.
- Custom Twig theme on Bootstrap Italia (installed with npm, no CDN); cache tags on render arrays.
- Configuration management in git, plus notes on the 9 → 10 upgrade and WCAG 2.1 AA.
wordpress
Extending WordPress without touching core: a child theme and a notices plugin for the same town hall.
- WordPress
- PHP 8.3
- Child theme
- Custom post type
- REST API
- Elementor
Highlights
- Child theme of Twenty Twenty-One: actions, filters and the template hierarchy.
- Plugin
comune-avvisi: custom post type, taxonomy and a meta box. - Secure form handling: nonces, capability checks, sanitising and escaping.
- Shortcode, REST meta field and a custom Elementor widget.













