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

v1.0.1 2026-01-22 13:50 UTC

This package is auto-updated.

Last update: 2026-01-22 14:02:16 UTC


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.php wraps the page
  • Root app/layout.php wraps 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 in layout.php
  • Pages can override metadata using the $metadata array
  • 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