Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ratulcse10/ee71916d3b2223234fed50e0c3171f33 to your computer and use it in GitHub Desktop.
Save ratulcse10/ee71916d3b2223234fed50e0c3171f33 to your computer and use it in GitHub Desktop.
create symfony process in laravel project
use Symfony\Component\Process\Process;
Route::get('test',function(){
$process = new Process('sudo apt-get update');
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
echo $process->getOutput();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment