Skip to content

Commit

Permalink
feat: added bind examples + PHP version in Twig globals
Browse files Browse the repository at this point in the history
  • Loading branch information
COil committed Apr 12, 2024
1 parent 151a458 commit 9dab26f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
bind:
# bind examples
#string $environment: '%kernel.environment%'
#string $debug: '%kernel.debug%'

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
Expand Down
3 changes: 2 additions & 1 deletion src/Twig/Extension/EnvExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ final class EnvExtension extends AbstractExtension implements GlobalsInterface
public function getGlobals(): array
{
return [
'version' => Kernel::VERSION,
'sf_version' => Kernel::VERSION,
'php_version' => PHP_VERSION,
];
}
}
2 changes: 1 addition & 1 deletion templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</section>

<footer>
<h5>{{ brand|raw }} v{{ version }}</h5>
<h5>{{ brand|raw }} v{{ sf_version }} (PHP {{ php_version }})</h5>

<grid>
<div fx="" col="3/4">
Expand Down

0 comments on commit 9dab26f

Please sign in to comment.