PHPackages                             nazar-pc/stream-slicer - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. nazar-pc/stream-slicer

ActiveLibrary[File &amp; Storage](/categories/file-storage)

nazar-pc/stream-slicer
======================

Get slice of any seekable stream

1.0.0(10y ago)831MITPHPPHP &gt;=5.6

Since May 11Pushed 10y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

[!\[Build Status\](https://img.shields.io/travis/nazar-pc/stream-slicer/master.svg?label=Travis CI)](https://travis-ci.org/nazar-pc/stream-slicer)

Stream slicer - Get slice of any seekable stream
------------------------------------------------

[](#stream-slicer---get-slice-of-any-seekable-stream)

When working with PHP streams you sometimes need to have a slice of some stream.

For instance, you're parsing a huge multipart message with multiple uploaded files. Obviously, you don't want to store gibibytes of data all in memory. so you're using stream and parse it piece by piece. But when you encounter the beginning of large file within that stream you'll also want to avoid storing it into memory or copy to some place in addition to original data. Unfortunately, PHP itself doesn't have primitive to create slice of that stream, but thanks to Stream slicer you can do it very easily.

Requirements:
-------------

[](#requirements)

- PHP 5.6+ or HHVM

How to use?
-----------

[](#how-to-use)

Simply add dependency on `nazar-pc/stream-slicer` to your project's `composer.json`:

```
{
    "require": {
        "nazar-pc/stream-slicer": "1.*"
    }
}
```

```
