1

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?

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.