reqiler / reqziel
Reqziel PHP Starter Project
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/reqiler/reqziel
Requires
- php: >=8.0
README
App RouterβStyle PHP Framework
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
π¦ Create Project
composer create-project reqiler/reqziel my-reqziel-app
Start the development server:
composer dev
or
php cli/app.php dev
Open in browser:
http://localhost:8000
β¨ Features
- π 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
π Project Structure
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
π§± Layout System
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>
π§ Metadata (Title & Description)
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
Example
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>
π Middleware
Route groups like (auth) can be protected automatically.
if ($route['group'] === 'auth' && !isset($_SESSION['user'])) { redirect('/'); }
π API Routes
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]);
π Deployment
- Apache or Nginx
- Set document root to
/public - No Node.js required
- Tailwind via CDN supported
π License
MIT License