Skip to content

Instantly share code, notes, and snippets.

@weierophinney
Created March 16, 2016 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weierophinney/c1bda9ec8c1018f15235 to your computer and use it in GitHub Desktop.
Save weierophinney/c1bda9ec8c1018f15235 to your computer and use it in GitHub Desktop.
Alternate way to push middleware into the pipeline between routing and dispatch.
<?php
use Zend\Expressive\Container\ApplicationFactory;
use Zend\Expressive\Helper;
return [
'middleware_pipeline' => [
'always' => [
'middleware' => [
Helper\ServerUrlMiddleware::class,
],
'priority' => 10000,
],
'routing' => [
'middleware' => ApplicationFactory::ROUTING_MIDDLEWARE,
'priority' => 1,
],
'inbetween' => [
'middleware' => [
// ...
],
'priority' => 0,
],
'dispatch' => [
'middleware' => ApplicationFactory::DISPATCH_MIDDLEWARE,
'priority' => -1,
],
'error' => [
'middleware' => [
],
'error' => true,
'priority' => -10000,
],
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment