jeudi 31 mars 2016

Laravel run composer / git commands within controller

is it possible to run composer or git commands from within a controller in Laravel? Something like that:

class TestController extends Controller
{
    //
    public function shell(Request $request){
        if($request->isMethod('post')){


            $data['output'] = shell_exec('composer update');
            // or some git commands
            return view('tests.shell', $data);
        } else {
            return view('tests.shell');
        }
    }
}

If I do it the way shown above, I get no message. I think, the problem is, that these commands have to be run in the projects root directory and not in an subfolder.

And is there a php function to run a complete shell script and not only single commands?

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1RzqDnD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire