Level 51
Try
$exitCode = Artisan::call('cache:clear');
https://laravel.com/docs/5.3/artisan#calling-commands-from-other-commands
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi I want to execute the terminal command cache:clear from the code. Please assist.
Please or to participate in this conversation.