Reqziel is a lightweight PHP framework inspired by modern App Router concepts. It brings file-based routing, nested layouts, middleware, and API routes to PHP — without Laravel or heavy abstractions.
🚀 Built for learning, experimentation, and lightweight production
🧠 Designed to understand how modern frameworks work under the hood
composer create-project reqiler/reqziel my-reqziel-appStart the development server:
composer devor
php cli/app.php devOpen in browser:
http://localhost:8000
- 📁 File-based Routing
- 🔀 Dynamic Routes using
[param] - 🧩 Route Groups using
(group)(not affecting URL) - 🧱 Nested Layout System
- 🔐 Middleware / Route Guards
- 🔌 API Routes under
/api - ⚙️ Dev Command similar to modern frameworks
- ❌ No Laravel, No heavy framework
my-reqziel-app/
├─ app/
│ ├─ page.php # /
│ ├─ layout.php # root layout
│ ├─ post/
│ │ └─ [id]/
│ │ └─ page.php # /post/123
│ └─ (auth)/
│ └─ admin/
│ ├─ layout.php
│ └─ page.php # /admin (protected)
│
├─ api/
│ └─ users.php # /api/users
│
├─ bootstrap/
│ ├─ app.php # bootstrap
│ ├─ router.php # file-based router
│ └─ middleware.php # middleware handler
│
├─ public/
│ ├─ index.php # front controller
│ ├─ router.php # dev router (php -S)
│ └─ .htaccess # Apache rewrite
│
├─ cli/
│ └─ app.php # CLI commands
│
├─ storage/
├─ composer.json
└─ README.md
Layouts are resolved automatically based on directory hierarchy.
Rules:
- The closest
layout.phpwraps the page - Root
app/layout.phpwraps everything - Layouts receive rendered page content via
$content
Example:
app/layout.php
app/(auth)/admin/layout.php
Inside layout.php:
<!DOCTYPE html>
<html>
<head>
<title><?= $metadata['title'] ?? 'Reqziel' ?></title>
</head>
<body>
<?= $content ?>
</body>
</html>Reqziel uses a layout-based metadata system.
<title>and<meta>tags live inlayout.php- Pages can override metadata using the
$metadataarray - Pages should not render
<head>or<html>tags
app/page.php
<?php
$metadata['title'] = 'Home';
$metadata['description'] = 'Welcome to Reqziel';
?>
<h1>Welcome</h1>app/post/[id]/page.php
<?php
$metadata['title'] = 'Post #' . $params['id'];
?>
<h1>Post <?= htmlspecialchars($params['id']) ?></h1>Route groups like (auth) can be protected automatically.
if ($route['group'] === 'auth' && !isset($_SESSION['user'])) {
redirect('/');
}All files inside /api are treated as API endpoints.
api/users.php → /api/users
Example:
header('Content-Type: application/json');
echo json_encode(['ok' => true]);- Apache or Nginx
- Set document root to
/public - No Node.js required
- Tailwind via CDN supported
MIT License