The LAMP stack — Linux, Apache, MySQL and PHP — powers a remarkable share of the web. Modern PHP gives us typed properties, enums, match expressions and first-class performance, which makes a lightweight architecture genuinely pleasant to build.
Why not use a framework?
Frameworks solve real problems, but they also bring upgrades, compatibility matrices and abstraction layers. For a focused product like a blog, a small routing layer, PDO prepared statements and a template system are enough — and they are yours to understand completely.
The architecture
- A single front controller (
public/index.php) receives every request. - A router maps clean URLs to controller methods.
- Controllers validate input, call models and return responses.
- Views escape all output by default.
Simplicity is a feature. Every dependency you add is a dependency you must understand, upgrade and secure.
Database design
Third normal form still earns its keep: categories and tags live in their own tables, linked to posts with composite pivot tables and cascading foreign keys.
\\\sql
SELECT p.id, p.title, COUNT(*) AS tags
FROM posts p
JOIN post_tags t ON t.post_id = p.id
GROUP BY p.id
ORDER BY p.published_at DESC
LIMIT 10;
\\\
The result is a schema that stays correct as the product grows, without any caching layer required to make it fast.