Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FutureWeb's avatar

Trigger an artisan command when endpoint is hit then another when that is complete

Hiya LaraFolks,

I am looking to trigger an artisan command when an end point is hit and then another when that command is complete.

here's the plan..

1). I fire a command using a cron twice a day at specific time this generates some data on another server and saves the output to a file. -> This I have done.

2). The server responds once complete to an end point on my server I provide a unique single use token in my call back and check the ip of the responding server. -> This is done also

3). When this end point is hit and validation is passed I want to trigger another artisan command to download the data.

4). Then once the data has downloaded I want to trigger another command which parses it.

I have written and tested all the commands I just need to figure out how to trigger 3 and 4 any help would be very much appreciated.

0 likes
3 replies
Snapey's avatar

Why don't you want to just run the job from a controller when the end point is hit? Why does it need to be an artisan command?

1 like
FutureWeb's avatar

Do you know what I didn't even think of that LOL what about the parsing just stick it in a job que?

Snapey's avatar

do it all in one request? The only issue is if you don't want the other server waiting.

I would probably queue a job and say 200 to the server sending you the trigger. In the queued job, download the file and parse it all as one activity.

Please or to participate in this conversation.