2017 © Pedro PelĂĄez
 

library stream

Stream is an object oriented library for reading and writing binary streams in PHP.

image

gravitymedia/stream

Stream is an object oriented library for reading and writing binary streams in PHP.

  • Monday, July 11, 2016
  • by pCoLaSD
  • Repository
  • 1 Watchers
  • 9 Stars
  • 82 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Stream

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads Dependency Status, (*1)

Stream is an object oriented library for reading and writing binary streams in PHP., (*2)

Requirements

This library has the following requirements:, (*3)

  • PHP 5.6+

Installation

Install Composer in your project:, (*4)

$ curl -s https://getcomposer.org/installer | php

Add the package to your composer.json and install it via Composer:, (*5)

$ php composer.phar require gravitymedia/stream

Usage

This is a simple usage example for character streams but is applicable for binary data streams., (*6)

require 'vendor/autoload.php';

use GravityMedia\Stream\Stream;

// create resource
$resource = fopen('php://temp', 'r+');

// create new stream object
$stream = Stream::fromResource($resource);

// write some data
$stream->write("\x63\x6f\x6e\x74\x65\x6e\x74\x73");

// seek a position
$stream->seek(4);

// print 32 bit unsigned integer
print $stream->readUInt32() . PHP_EOL;

// rewind stream
$stream->rewind();

// print the data previously written
while (!$stream->eof()) {
    print $stream->read(1);
}
print PHP_EOL;

// print position
print $stream->tell() . PHP_EOL;

// rewind stream
$stream->rewind();

// truncate random data
$stream->truncate(7);

// print the truncated data
while (!$stream->eof()) {
    print $stream->read(1);
}
print PHP_EOL;

Testing

Clone this repository, install Composer and all dependencies:, (*7)

$ php composer.phar install

Run the test suite:, (*8)

$ php vendor/bin/phing test

Generating documentation

Clone this repository, install Composer and all dependencies:, (*9)

$ php composer.phar install

Generate the documentation to the build/docs directory:, (*10)

$ php vendor/bin/phing doc

Contributing

Please see CONTRIBUTING for details., (*11)

Credits

License

The MIT License (MIT). Please see License File for more information., (*12)

The Versions

11/07 2016

dev-master

9999999-dev https://github.com/GravityMedia/Stream

Stream is an object oriented library for reading and writing binary streams in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

binary stream gravitymedia fread fwrite