- The
Silex\Applicationloads the'route_factory', which returns an instance of aSilex\Route. - When mounted in a
Silex\ControllerCollection, it accepts Middlewares attached tobefore()orafter()methods. Those are actually Options for theSymfony\..\RouteComponent. - Attached are
MiddlewareListeners
So in Silex, this:
// ex. #1
$app['controllers']->before( 'callback', APPLICATION::EARLY_EVENT );
// ex. #2
$app['controllers']->after( 'callback', Application::LATE_EVENT );
is equal to
// use Symfony\Component\HttpKernel\KernelEvents;
// #1
$app->on( KernelEvents::REQUEST, 'callback' );
// #2
$app->on( KernelEvents::TERMINATE, 'callback' );
and works without annotations or YAML.