A lightweight HTTP routing library for PHP 8+ without external dependencies. (WIP)
APACHE-2.0 License
Fixes
Request
class.Features
Before
routing middleware support.
<?php
// Middleware example that should be defined at the beginning
Ruta::before(function (Request $req, Response $resp) {});
Refactorings
Response
class data state.Ruta
classes logic. PR #1Published by joseluisq over 2 years ago
Fixes
{abc}
) when parsing.Features
array $data
param for every route callback function.
<?php
// NOTE: the array (right side) will be passed to the `$data` param in the callback if defined.
Ruta::get('/abc', function (Request $req, array $data) {}, ['some' => 'data']);
route_data
property if Ruta
class is extended.array $args, array $data
).
<?php
// NOTE: all arguments are optional and order-insensitive.
Ruta::get('/todo/{id}', function (Request $req, Response $resp, array $args, array $data) {});
Published by joseluisq over 2 years ago
Fixes
Published by joseluisq over 2 years ago
Refactorings
Published by joseluisq over 2 years ago
Features
/abc/regex(id=^[0-9]+$)/def
Published by joseluisq almost 3 years ago
First beta release