Tom Hatzer • January 14, 2021 https://blog.tomhatzer.com/blog/categories/pimcore It's pretty easy to call CLI commands from within your Pimcore controllers. In my case I wanted to rebuild the Pimcore data object classes after deploying to a system where I had no SSH access to. This was done with a class that looked something like this: setAutoExit(false); $args = [ 'command' => 'pimcore:deployment:classes-rebuild', // '-q' // remove the comment at the start of the line to suppress command output ]; $input = new ArrayInput($args); // You can use NullOutput() if you don't need the output $output = new BufferedOutput(); $application->run($input, $output); // return the output, don't use if you used NullOutput() $content = $output->fetch(); // return new Response(""), if you used NullOutput() return new Response($content); }} You then just need to add this controller action to your routes configuration file and possibly add a check to allow only users with permission to execute the action.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners