I have an image under the public folder. How can I get my image directory in symfony4 ? In symfony 3, it\'s equivalent is :
public
$webPath = $this
You can inject KernelInterface to the service or whatever and then get the project directory with $kernel->getProjectDir():
KernelInterface
$kernel->getProjectDir()
projectDir = $kernel->getProjectDir(); } public function showProjectDir() { echo "This is the project directory: " . $this->projectDir; } }