Slim Flash in Middleware


I’m new to using Slim but have been developing on PHP for a while. I did do a search here first before posting so sorry if this is me missing something simple.

I’v created some middleware using ZF2 ACL, it works fine until I try and DI Slim-Flash into the middleware at which point flash stops working across the app. However it works fine if I change it to router middleware, Ive commented out the flash for now while so I can continue working on the app.

Here is a gist of what I’m doing:

Thanks for your help

Sorted, changed this in dependencies.php: $view->addExtension(new Knlv\Slim\Views\TwigMessages($container[‘flash’]));
from $view->addExtension(new App\Twig\Extensions\CsrfExtension(new Slim\Flash\Messages()));

Hope it helps someone else :wink: