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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners