How to Write Middleware

Yee application middleware must subclass \Yee\Middleware and implement a public call() method. The call() method does not accept arguments. Middleware may implement its own constructor, properties, and methods. We encourage you to look at Yees’s built-in middleware for working examples (e.g. Yee/Middleware/ContentTypes.php or Yee/Middleware/SessionCookie.php).

This example is the most simple implementation of Yee application middleware. It extends \Yee\Middleware, implements a public call() method, and calls the next inner middleware.

<?php
class MyMiddleware extends \Yee\Middleware
{
    public function call()
    {
        $this->next->call();
    }
}