instructor-php icon indicating copy to clipboard operation
instructor-php copied to clipboard

Process Each Item in an Array of Objects as Soon as It Completes

Open raftx24 opened this issue 1 year ago • 1 comments

In many scenarios, when working with an array of objects, you might want to process each item independently as soon as it finishes, rather than waiting for all items to complete. This is particularly useful when dealing with asynchronous tasks, where each operation might take varying amounts of time. If this is deemed a valuable addition, I would be happy to implement this functionality.

raftx24 avatar Sep 24 '24 22:09 raftx24

Please check responseModel: Sequence::of(YourClass::class) + streaming on - I think it might be what you are looking for. https://docs.instructorphp.com/advanced/sequences

If that's not the case, feel free to suggest how this could be solved.

ddebowczyk avatar Oct 01 '24 04:10 ddebowczyk

Marked for closing as it is supported out of the box for streaming. Async is not yet supported by Instructor.

ddebowczyk avatar Nov 04 '24 12:11 ddebowczyk