Is it possible to call Shell commands (e.g for converting images ) from Laravel controller? If yes then how. I have searched on internet. Nothing seems relevant.
You can use the Process component provided by Symfony: http://symfony.com/doc/current/components/process.html
The component is used by Laravel itself, so your don't need to install it via composer separately. Just add use Symfony\Component\Process\Process;
to your file.
If you use it(instead of php's exec()
function), you'll be able to unit test the code that calls shell commands.
It all depends on what operating system you are using. php already has a few functions to execute shell commands.
Laravel has a build in task runner for ssh commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With