-
-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Support to incrementally feed the parser via an explicit method call where the pull approach of foreach cannot be used. Useful for example for curl's CURLOPT_WRITEFUNCTION
or when receiving json chunks in an event loop.
Proposed usage (implicit):
$items = new PushItems(['pointer' => '/results']);
$callback = function ($jsonChunk) use ($items) {
$items->push($jsonChunk);
foreach($items as $item) {
// process currently available items
}
}
or more explicit (similar to current API):
$queue = new QueueChunks();
$items = Items::fromQueue($queue, ['pointer' => '/results']);
$callback = function ($jsonChunk) use ($items, $queue) {
$queue->push($jsonChunk);
foreach($items as $item) {
// process currently available items
}
}
Any other proposal?
tradzero
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Projects
Status
Inbox