Sredny M Casanova Sredny M Casanova - 1 month ago 5
PHP Question

execute script cyclically through Laravel 5

I have a Laravel 5 app, it works fine. Then, I have a plain PHP script that I need to execute every X time (could be minutes, hours or even every X days) so, I want to execute it automatically using Laravel, how can I do it and which is the proper way to achieve this? I don't want to manually be running the script. And also, can I do this in the same Laravel app or should I create a new one?
Currently I have to execute the script using the CLI.

Answer

You can use Task Scheduling, it makes scheduling anything you need to quite simple.

https://laravel.com/docs/5.3/scheduling

^ Have a look through the link you should be able to find everything you need