Symfony Twig: Accessing global values reference

Here is a reference list to access global values within Twig:

For $_POST variables use this :

{{ app.request.parameter.get("page") }}

For $_GET variables use this :

{{ app.request.query.get("page") }}

For $_COOKIE variables use this :

{{ app.request.cookies.get("page") }}

For $_SESSION variables use this :

{{ app.request.session.get("page") }}

For more Symfony Twig shortcuts, view the Twig Cheatsheet with recent updates added, a perfect reference for Symfony web developers.

About Author:

Senior Cloud Software Engineer and 25+ years experienced video production, video editing and 3D animation services for a variety of global clients including local video production here in Jacksonville, Florida.

Leave a Comment

Your email address will not be published. Required fields are marked *