src/Horizon/ApiClient.php
public function streamLedgers($sinceCursor = 'now', callable $callback = null)
    {
        $url = sprintf('/ledgers');
        $params = [];

        if ($sinceCursor) $params['cursor'] = $sinceCursor;

        if ($params) {
            $url .= '?' . http_build_query($params);
        }

        $this->getAndStream($url, function($rawData) use ($callback) {
            $parsedObject = Ledger::fromRawResponseData($rawData);
            $parsedObject->setApiClient($this);

            $callback($parsedObject);
        });
    }
public function streamLedgers($sinceCursor = 'now', callable $callback = null)
    {
        $url = sprintf('/ledgers');
        $params = [];

        if ($sinceCursor) $params['cursor'] = $sinceCursor;

        if ($params) {
            $url .= '?' . http_build_query($params);
        }

        $this->getAndStream($url, function($rawData) use ($callback) {
            $parsedObject = Ledger::fromRawResponseData($rawData);
            $parsedObject->setApiClient($this);

            $callback($parsedObject);
        });
    }
Streams Ledger objects to $callback

$callback should have arguments:
Ledger

For example:

$client = ApiClient::newPublicClient();
$client->streamLedgers('now', function(Ledger $ledger) {
printf('[%s] Closed %s at %s with %s operations' . PHP_EOL,
(new \DateTime())->format('Y-m-d h:i:sa'),
$ledger->getId(),
$ledger->getClosedAt()->format('Y-m-d h:i:sa'),
$ledger->getOperationCount()
);
});

@param null $sinceCursor
@param callable $callback