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

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

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

        $this->getAndStream($url, function($rawData) use ($callback) {
            switch ($rawData['type']) {
                case 'create_account':
                    $parsedObject = CreateAccountOperation::fromRawResponseData($rawData);
                    break;
                case 'payment':
                    $parsedObject = Payment::fromRawResponseData($rawData);
                    break;
                case 'account_merge':
                    $parsedObject = AccountMergeOperation::fromRawResponseData($rawData);
                    break;
                case 'path_payment':
                    $parsedObject = PathPayment::fromRawResponseData($rawData);
                    break;
            }

            $parsedObject->setApiClient($this);

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

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

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

        $this->getAndStream($url, function($rawData) use ($callback) {
            switch ($rawData['type']) {
                case 'create_account':
                    $parsedObject = CreateAccountOperation::fromRawResponseData($rawData);
                    break;
                case 'payment':
                    $parsedObject = Payment::fromRawResponseData($rawData);
                    break;
                case 'account_merge':
                    $parsedObject = AccountMergeOperation::fromRawResponseData($rawData);
                    break;
                case 'path_payment':
                    $parsedObject = PathPayment::fromRawResponseData($rawData);
                    break;
            }

            $parsedObject->setApiClient($this);

            $callback($parsedObject);
        });
    }
Streams Payment or CreateAccount objects to $callback

$callback should have arguments:
AssetTransferInterface

For example:

$client = ApiClient::newPublicClient();
$client->streamPayments('now', function(AssetTransferInterface $payment) {
printf('Payment: from %s to %s' . PHP_EOL, $payment->getFromAccountId(), $payment->getToAccountId());
});

@param null $sinceCursor
@param callable $callback