How can I run native terminal command (e.g: bower) with symfony/console?
I had bower installed in my mac, and can be run from console. But now i need symfony/console to be able run my native terminal command (e.g: bower).
How to do that?
How can I run native terminal command (e.g: bower) with symfony/console?
I had bower installed in my mac, and can be run from console. But now i need symfony/console to be able run my native terminal command (e.g: bower).
How to do that?
You can use PHP's exec function. Or, if you want to have more controll of it and read the result in a nice way, you can use the Symfony Process component:
exec('bower');
// or it's shortcut
`bower`;
// or the Process component
use Symfony\Component\Process\Process;
$bower = new Process('bower');
$bower->run();
// ... other nice things, like $bower->isSuccesful(), ->getOutput() & more