Quantcast
Channel: PHPDeveloper.org
Viewing all articles
Browse latest Browse all 14

Barry vd. Heuvel: Using StackPHP middleware in Laravel5

$
0
0

Barry vd. Heuvel has a new post sharing a method he's found for using StackPHP middleware with Laravel 5 and provides a library of his own to make moving between the middleware types easier.

In version 4.1, Laravel introduced compatibility with StackPHP middleware. [...] In Laravel 5, a lot of things changed. And with those changes, Laravel also removed the support for StackPHP middleware and introduced its own middleware contract.

As the two types of middleware have interfaces that slightly conflict, he shows how to convert from one to the other (a relatively simple change). He then shows how to use the middleware in a Laravel 5 application, but brings up a "chicken and the egg" situation where a wrapper for the HttpKernelInterface is needed for correct injection. To that end he created two simple wrappers, the ClosureMiddleware and ClosureHttpKernel handlers that can be used to simplify this middleware translation.

Link: http://barryvdh.nl/laravel/2015/02/18/using-stackphp-middleware-in-laravel-5/

Viewing all articles
Browse latest Browse all 14

Latest Images

Trending Articles



Latest Images