New, Faster, Safer Maravel Micro-Framework Router
Maravel-Framework 10.67.0 brings a new, faster and safer Router via Maravel 10.52.48.
It all started after I finished refactoring the deferred service providers to gain boot speed (see history:
Maravel-Framework 10.64.17 brings domain routes restriction to Maravel Micro-Framework,
The Zero-Cost Boot Hack Every Maravel Developer Needs to Know
) because Symfony router is faster than Fast Route and I think first place is better, even if only in some scenarios.
With the help of Gemini, I put this together to patch an important part that the FastRoute doesn’t, the 404 Firewall that was eating resources for nothing on dynamic routes. This is the most important gain, even if the FastRoute is still handling the complex routes, which are far less than all dynamic routes.
To keep it as fast as possible, avoid complex routes.
This is NOT a complex route:
$r->addRoute('GET', '/user/{id:\d+}', 'handler');A new match method was introduced:
$router->match(['GET', 'POST'], $uri, $callback);The Hello World bench is not touched by this change because it uses a static route:
Press enter or click to view image in full size
The documentation has been updated.
Full article https://marius-ciclistu.medium.com/new-faster-safer-maravel-micro-framework-router-7aaddc8fd028 .


Replies