paranoid
paranoid

Reputation: 7105

composer dump-autoload not working on controller Laravel 5

I want run php /bin/composer.phar dump-autoload on my controller.
When I run shell_exec("php /bin/composer.phar dump-autoload");
dose not work because when I run shell_exec("dir"); I am on public folder and When I run this command shell_exec("cd.. & php /bin/composer.phar dump-autoload"); Nothing not happen because when run shell_exec("cd .. ; dir ") I am on public folder yet. My host in centos 6

Upvotes: 1

Views: 833

Answers (1)

Rwd
Rwd

Reputation: 35180

You could try using \Symfony\Components\Process\Process.

So you would have something like:

(new \Symfony\Components\Process\Process('composer dump-autoload', base_path()))->setTimeout(10)->mustRun();

Hope this helps!

Upvotes: 4

Related Questions