it would help if you show us the code that you think is too long. I can't imagine 12 lines of API calls actually cluttering it, I can imagine the surrounding logic becoming a problem.
Laravel Queue Job file getting too long.
So I have a laravel queue/job that completes a pretty simple task. It just connects to some API's, collects most recent market prices, converts it to a standard/readable format then it saves those details to the database for later use, and it runs through Redis every 10 minutes to keep the details up to date.
Now the problem is that as the project has grown, so has the need for it to connect to more API's and gather even more information.
So much so that it's gathering information from close to a dozen different API's now to collect and edit all the information the platform needs.
Unfortunately it's getting quite long, messy/cluttered and unpleasant to read/update.
Currently I've always just separated each API into its own Private Function, and then had each one called from the Handle Function inside the queue job as each one is needed.
Now the question is, if I wanted to clean everything up and split all this logic up into multiple places, what would be the most ideal way of doing this?
To split each API call into it's own individual queue job file? or to split the logic up into different Action or Service Classes and then call those classes from the Jobs file as needed?
Or is there another method that you think would make splitting all this logic up cleaner and more efficient?
Thanks for any help/tips/ideas.
Please or to participate in this conversation.