wok/stream

WOK Stream handler component

v1.1.0 2017-01-25 09:28 UTC

This package is auto-updated.

Last update: 2024-04-25 06:57:58 UTC


README

This library is a Stream handler.

Diclaimer : This component is part of the WOK (Web Operational Kit) framework. It however can be used as a standalone library.

Install

It is recommanded to install that component as a dependency using Composer :

composer require wok/stream

You're also free to get it with git or by direct download while this package has no dependencies.

git clone https://github.com/web-operational-kit/stream.git

Usage

use \WOK\Stream\Stream;

/**
 * Instanciation
 * ---
**/

// Instanciate handler from a resource (default)
$resource = fopen('php://temp', 'w+');
$stream = new Stream($resource);

// Instanciate handler from a file
$stream = Stream::createFromFile('/path/to/my/file.txt');

// Instanciate handler from a string
$stream = Stream::createFromString('here is my string');