Search by

danish / php-router

danis570

A lightweight URL routing library for PHP web applications

Package info

github.com/danis570/php-router

pkg:composer/danish/php-router

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-10-16 07:18 UTC

This package is auto-updated.

Last update: 2026-10-16 07:22:36 UTC


README

----------------------- VERSION 1.0.0 ------------------------

index.php

Database::getConnection('prod');

Router::get('/', [Controller::class, 'index']);
Router::post('/path', [Controller::class, 'postAdd']);

Router::run();

In version 1.0.0, the following are not supported:

  • Middleware
  • Route Parameters (/path/{id})
  • Route Group By
    • Controller
    • Middleware

----------------------- VERSION 1.1.0 ------------------------

New Features

  • Added optional middleware support for GET routes.
  • Added optional middleware support for POST routes.
  • Middleware can execute before the route controller.

index.php

Router::get('/', [Controller::class, 'index']);
Router::post('/path', [Controller::class, 'postAdd']);
Router::get(
    '/dashboard',
    [DashboardController::class, 'index'],
    [LoginMiddleware::class]
);
Router::get(
    '/dashboard',
    [DashboardController::class, 'index'],
    [LoginMiddleware::class, AdminMiddleware::class]
);

Router::run();