Skip to content

CollinsFabian/Ziro

Repository files navigation

Ziro

A minimal, no-nonsense PHP framework focused on simplicity, direct execution, and full developer control.


Overview

Ziro is designed for developers who prefer writing raw, understandable PHP without heavy abstractions or unnecessary framework layers.

No magic. No complex containers. Just straightforward routing and execution.


Features

  • Simple routing (closures and controllers)
  • Direct execution flow
  • Lightweight core
  • Flexible architecture (no enforced structure)

Usage

Starting a server

php -S localhost:3000 -t public

Define Routes

$router->get('/', function () {
    return "Hello world";
});

$router->get('/home', fn() => to("/")); // redirecting urls (old/legacy) to new routes

$router->get('/user/{id}', [UserController::class, 'show']);

$router->get('/dashboard', [DashboardController::class, 'index'])->middleware([\Core\Middleware\AuthMiddleware::class]);

Controller Example

class UserController
{
    public function show($id)
    {
        return "User: " . $id;
    }
}

Route Execution

public function executeRoute(array $route, Request $request)
{
    $action = $route['action'];
    $params = $route['params'] ?? [];

    if (is_callable($action)) return $action($request, ...array_values($params));

    if (is_array($action)) {
        [$controller, $method] = $action;
        $instance = $this->container->make($controller);

        return $instance->$method(...array_values($params));
    }

    throw new \Exception("Invalid route action");
}

Philosophy

  • Keep it simple
  • Avoid unnecessary abstraction
  • Give developers full control

Not (yet) Inplemented

  • Models (under works)
  • Additional features

License

MIT

About

Ziro Framework: Ziro friction, Maximum velocity

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors