This version is outdated. You should upgrade your project to Mako 9.1 or Mako 10.0!
Getting started

Upgrading



This guide takes you through the steps needed to migrate from Mako 5.2.x to 5.3.x.


Application

You'll have to create a constraints.php file and a constraints directory in your app/routing directory (remember to add a .gitkeep file in the constraints directory).


Framework

Routing

The when method has been renamed to patterns.

HTTP Middleware

All HTTP middleware must now implement the mako\http\routing\middleware\MiddlewareInterface. An abstract class (mako\http\routing\middleware\Middleware) implementing parts of the interface is included.

Middleware parameters are no longer injected through the constructor but instead via a the setParameters method (implemented by the abstract base class). Classes extending the included abstract base middleware can also retrieve parameters using the getParameter method.

Middleware is now registered with the route dispatcher.

// Old

$middleware->register('foo', Foo::class);

// New

$dispatcher->registerMiddleware('foo', Foo::class);

Middleware priority is now registered with the route dispatcher.

// Old

$middleware->setPriority(['foo' => 1]);

// New

$dispatcher->setMiddlewarePriority(['foo' => 1]);

See the routing docs for more details.