# Need help for middleware orchestration Twig, Cas, sessionMiddleware

**URL:** <https://discourse.slimframework.com/t/need-help-for-middleware-orchestration-twig-cas-sessionmiddleware/6119>\
**Category:** Questions\
**Created:** [May 5, 2025, 6:57pm UTC](https://discourse.slimframework.com/t/need-help-for-middleware-orchestration-twig-cas-sessionmiddleware/6119 "2025-05-05T18:57:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mixman68](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/mixman68/32/1687_2.png) [@mixman68](https://discourse.slimframework.com/u/mixman68)\
**Post date:** [May 5, 2025, 10:12pm UTC](https://discourse.slimframework.com/t/need-help-for-middleware-orchestration-twig-cas-sessionmiddleware/6119/2 "2025-05-05T22:12:10Z")

</div>

Finally I found the solution

I kept middleware.php with this init :

```auto
$app->add(TwigMiddleware::createFromContainer(
    $app,
    \Slim\Views\Twig::class
));

```

and I set the session with this : [Accessing \_SESSION variable in TWIG - #10 by odan](https://discourse.slimframework.com/t/accessing-session-variable-in-twig/4232/10)

---

_[View the full topic](https://discourse.slimframework.com/t/need-help-for-middleware-orchestration-twig-cas-sessionmiddleware/6119)._
