September 3, 2022
Symfony / Twig Cheat Sheet
These are often-used commands when coding in PHP. I frequently use them when working with Symfony Framework and Twig.
// created is DateTime variable
{{ object.created | date('m-d-Y H:i:s') }}
// details is an array
{{ object.details | join(', ') }}
// details is a JSON object, goal to print single string
{{ object.details | json_encode(constant('JSON_PRETTY_PRINT')) }}
FILED UNDER: Software Development
RELATED POST TO READ
Symfony / Doctrine Cheat Sheet
Common Symfony and Doctrine commands for quick reference when writing PHP.