In the src/Utils directory, I created a custom class Foo for various things. I\'m looking for a way to get the absolute root path of the symfony 4 project <
Without Kernel injection
Kernel
config/services.yaml
services: _defaults: autowire: true autoconfigure: true bind: $projectDir: '%kernel.project_dir%'
....
class Foo { private $projectDir; public function __construct(string $projectDir) { $this->projectDir = $projectDir; } }