Download the PHP package rkr/streams without Composer

On this page you can find all versions of the php package rkr/streams. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package streams

php-streams

This library is work-in-progress.

As an alternative, have a look at this: https://github.com/fzaninotto/Streamer

This is a generic and framework-agnostic approach to stream interfaces. The goal is to provide an abstraction layer for both stream providers and stream consumers. There is documentation for usage and expected behavior. Proper exceptions and compliance tests are also included.

Streams

Streams are useful for reading and writing from resources. By this I do not mean the stream approach that was introduced with Java8, for example. Specifically for PHP, streams also have the advantage that streams do not clone their data when passed as function or method parameters, which can result in much lower memory consumption when large strings are used intensively. Resources can be anything capable of outputting or consuming a stream of byte-streams:

Why use streams instead of string?

Streams ...

Because of abstraction and polymorphy, an application, service, or framework can fall back on a corresponding interface and is henceforth capable of dealing with byte streams of any form.

The interfaces are built with the SOLID-principles in mind, especially the interface-segregation-principle.

For example, a logger only needs to depend on one OutputStream. The logger does not need to know anything about the stream size or the current cursor position. A logger should have no knowledge of log file rotation or memory monitoring. This should be a matter for an external component. So the logger could write to any writable stream without having any idea what kind of stream it actually is.

Under certain circumstances, streams can be serializable. This is the case when a stream implements the SerializableStream interface. Internally, normally only the state of the stream is serialized. On deserialization, the state is restored and the stream tries to get to the last position in the stream. A serializable memory stream must store the entire contents somewhere during serialization.

Charsets and data-types

PHP does not have support for clearly identified byte arrays as Java does. Each read and write operation is done using strings, which are an array of (currently, as of PHP 5.x, 7.x and 8.x) 8-bit characters. In principle, a string is a byte array, but you shouldn't rely on it to remain so forever. Streams are generally character set agnostic. It is a matter of the particular implementation and its documentation how the incoming and outgoing data is handled. The (upcoming) standard implementation of this library will provide simple 8-bit access to the supported resources.

Overview

Stream

Stream is the base-class (marker-class) for a number of other classes. Its main purpose is to provide functionality to connect or disconnect to a stream and give a base type for type-hinting:

Method Return-type Possible exception(s)
connect() static ResourceLockedException, IOException
disconnect() static IOException

InfiniteInputStream

An InfiniteInputStream is a read-only stream that has no end by definition.

Examples:

InputStream

An InputStream is a read-only stream that has an end.

The InputStream publish these methods:

Method Return-type Possible exception(s)
read($length = null) string IOException
isAtEnd() bool -

Examples:

OutputStream

An OutputStream is a write-only stream. It has no information on its size or the cursor-position in the stream. The OutputStream is good for situations were it doesn't matter if a Stream has other abilities then writing data.

Method Return-type Possible exception(s)
write($data) static IOException
flush() static IOException

Examples:

TruncatableStream

Applies to resources which are truncatable.

Method Return-type Possible exception(s)
truncate() static IOException

SeekableStream

Method Return-type Possible exception(s)
getSize() int IOException
getPosition() int IOException
setPosition($pos) static IOException
rewind() static IOException

RandomAccessStream

The VersatileStream applies to fully accessible resources like local files. It extends InputStream, OutputStream and SeekableStream. This interface should likly be used for read-, writable- and seekable resources.

Examples:

Versioning

www.semver.org


All versions of streams with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rkr/streams contains the following files

Loading the files please wait ....