Marius Pantea

New, Faster, Safer Maravel Micro-Framework Router

by

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:

) 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 .

4 views

Add a comment

Replies

Be the first to comment