PHPackages                             pulyavin/streams - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. pulyavin/streams

ActiveLibrary[HTTP &amp; Networking](/categories/http)

pulyavin/streams
================

PHP wrapper for multi curl

1.0.0(10y ago)54.4k1PHPPHP &gt;=5.3

Since Apr 12Pushed 10y agoCompare

[ Source](https://github.com/pulyavin/streams)[ Packagist](https://packagist.org/packages/pulyavin/streams)[ Docs](https://github.com/pulyavin/streams)[ RSS](/packages/pulyavin-streams/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (1)

streams
=======

[](#streams)

"streams" is a PHP wrapper for multi curl

Installation
------------

[](#installation)

1. Install [Composer](http://getcomposer.org/):

    ```
    curl -sS https://getcomposer.org/installer | php

    ```
2. Add the streams dependency:

    ```
    php composer.phar require 'pulyavin/streams:0.*'

    ```

Usage
-----

[](#usage)

```
use pulyavin\streams\Stream;
use pulyavin\streams\Streamer;

$callbackSuccess = function ($stream) {
    /** @var $stream Stream */
    var_dump($stream->getInfo("url"));

    // to use in Streamer::map
    return $stream->getResponse();
};

$callbackFail = function ($stream) {
    /** @var $stream Stream */
    var_dump($stream->getError());
};

$callbackSymfony = function ($stream) {
    /** @var $stream Stream */
    var_dump($stream->getError());
    var_dump($stream->getOpt());

    // to use in Streamer::map
    return $stream->getResponse();
};

try {
    // new Stream object
    $stream1 = new Stream("http://laravel.com", $callbackSuccess, $callbackFail);

    // new Stream object with additional GET params
    // URL will be http://phalconphp.com?page=download&lang=eng
    $stream2 = new Stream([
        "http://phalconphp.com",
        [
            'page' => 'download',
            'lang' => 'eng'
        ]
    ], $callbackSuccess);

    // new Stream object with additional CURL-options
    $stream3 = new Stream("http://symfony.com", $callbackSymfony);
    $stream3->setOpt(CURLOPT_HEADER, true);
    $stream3->setOpt(CURLOPT_ENCODING, "gzip, deflate");
    // additional Stream tools
    $stream3->setProxy("56.156.50.69:80", "username", "password");
    $stream3->saveCookie("./cookie.txt");
    $stream3->setTimeout(3, 3);

    // or this way...
    $stream4 = new Stream("http://yiiframework.com", $callbackSuccess);
    $stream4->pushOpt([
        CURLOPT_HEADER         => true,
        CURLOPT_CONNECTTIMEOUT => 5,
        CURLOPT_TIMEOUT        => 5,
    ]);

    $stream5 = new Stream("http://www.codeigniter.com", $callbackSuccess);
    // set some cookie params
    $stream5->setCookie("name", "John");
    $stream5->setCookie("last", "1418197053");
    // push some cookie params
    $stream5->pushCookie([
        'banner' => '1',
        'guest'  => '1',
    ]);
    // and we got such HTTP headers
    // Cookie: name=John; last=1418197053; banner=1; guest=1;

    $stream6 = new Stream("http://kohanaframework.org",
        function($stream) {
            /** @var $stream Stream */
            var_dump($stream->getInfo("url"));

            // to use in Streamer::map
            return $stream->getResponse();
        },
        function($stream) {
            /** @var $stream Stream */
            var_dump($stream->getError());
        }
    );

    $stream7 = new Stream("http://cakephp.org", $callbackSuccess);
    $stream8 = new Stream("http://framework.zend.com", $callbackSuccess);

    // add pool of Streams in constructor
    $streamer = new Streamer([$stream1, $stream2, $stream3]);
    // or add them separately using method add() in Streamer-object
    $streamer->setStream($stream4);
    $streamer->setStream($stream5);
    // or push
    $streamer->pushStream([$stream6, $stream7, $stream8]);

    // Streams execution
    $streamer->exec();

    $map = $streamer->map(function ($response) {
        return strlen($response);
    });

    var_dump($map);
} catch (pulyavin\streams\Exception $e) {
    echo $e->getMessage();
}
```

You can use Stream as a single object, without putting it in pool of Streams

```
use pulyavin\streams\Stream;

$search = "some line";

try {
    $stream = new Stream([
        "http://google.com",
        [
            'q'       => 'Hello world!',
            'channel' => 'fs'
        ]
    ]);

    $stream->setAuth("mylogin", "mysafepassword");

    $stream->setOpt(CURLOPT_HEADER, true);
    $stream->setOpt(CURLOPT_ENCODING, "gzip, deflate");

    $stream->pushOpt([
        CURLOPT_CONNECTTIMEOUT => 5,
        CURLOPT_TIMEOUT        => 5,
    ]);

    $stream->setCA("./certificate.cer");

    $stream->setAgent("Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)");

    $stream->setReferer("http://yandex.ru/");

    $stream->setProxy("56.156.50.69:80", "username", "password");

    $stream->saveCookie("./cookies.txt");

    // HTTP verb is POST, and POST data is
    $stream->setPost('client' , 'linux');
    $stream->setPost('ie' , 'utf-8');
    $stream->pushPost([
        'oe'     => 'utf-8',
        'ei'     => 'L6gzVZ31CAeZ4cTlpICgBA',
    ]);

    $stream->setHeader("X-PARAM-FIRST", "first");
    $stream->setHeader("X-PARAM-SECOND", "second");

    $stream->pushHeader([
        'X-PARAM-THIRD'  => 'third',
        'X-PARAM-FOURTH' => 'fourth',
    ]);

    $response = $stream->exec();

    var_dump($response);
}
catch (pulyavin\streams\Exception $e) {
    echo $e->getMessage();
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Total

6

Last Release

3903d ago

Major Versions

0.2.1 → 1.0.02015-09-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/836b21ca4e9183229c20d1dc4724d6308ad608aa5c1081ccd3b718e4baf5717d?d=identicon)[pulyavin](/maintainers/pulyavin)

---

Top Contributors

[![pulyavin](https://avatars.githubusercontent.com/u/9364583?v=4)](https://github.com/pulyavin "pulyavin (49 commits)")

### Embed Badge

![Health badge](/badges/pulyavin-streams/health.svg)

```
[![Health](https://phpackages.com/badges/pulyavin-streams/health.svg)](https://phpackages.com/packages/pulyavin-streams)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
