Closed
Description
Description
I had the problem that I had to check in a service if the function is called via CLI or web.
Depending on that, I had to make different calculations. That's where my idea comes from, that you could put a function isCLI()
or isWeb()
into the kernel.
Example
class MyService {
public function __constructor(
private readonly KernelInterface $kernel
){}
public function myFunction(): void {
if(!$this->kernel->isCLI())
{
return;
}
// Do things in CLI without Request()
}
}