Download the PHP package hadasbro/php-streams without Composer

On this page you can find all versions of the php package hadasbro/php-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 php-streams

PHP Streams

PHP Composer

PHP 7.4+ License MIT Ver 1.0.4

This is just Collections API in PHP. Library helps to handle collections such as arrays or in general iterable elements and perform operations on them. Operations on Collection/Stream can be chained.

See usage examples in /Examples and unit tests in the project.

Project status: project is in progress, curent basic version is ver 1.0.4. Next versions will be using generators (yield) instead of normal looping and arrays.

Install

Installation via Composer

Usage Examples

Stream usage

Init / Construct options

Example of chaned operations on stream

Sample Object
Example - arrow functions used for operations (PHP >= 7.4)

See more Arrow Functions PHP 7.4

Example - lambda functions used for operations

Raw examples, static usage - lambda functions used for operations

Example of Collections::collect (predefined collectors)

Examples:

Predefined collectors

Example of Collections::allMatch (all objects from our array are also in another array)
Example of Collections::distinct (get only objects with different IDs)
Example of Collections::filter (get only objects with the ID < 11)
Example of Collections::reject (remove objects with ID < 11)
Example of Collections::map, Collections::transform (modify every objeect's ID to be + 100)
Example of Collections::minMax (get object with the lowest ID)
Example of Collections::sort (sort collection of objects to start from objects with the lowest ID)
Example of Collections::orElse (get collection with objects but replace each one with ID <= 0 to default one)
Example of Collections::reduce (reduce array of objects info arrayof their a bit modified IDs)
Example of Collections::groupBy (group objects by type)
Example of Collections::countBy and Collections::count (group objects by type)
Example of Collections::contains and Collections::search (search elements in a collection or just check if collection contains element)
Example of Collections::forEach (consuming collection's elements)
Example of Collections::toAssocArray (transform collection to associative array of elements)
Other examples - Collections::isEmpty, Collections::isNotEmpty and others

Raw examples, static usage - arrow functions used for operations (PHP >= 7.4)

Example of Collections::allMatch, Collections::aanyMatch (all objects from our array are also in another array)
Example of Collections::filter (get only objects with the ID < 11)
Example of Collections::reject (remove objects with ID < 11)
Example of Collections::map, Collections::transform (modify every objeect's ID to be + 100)
Example of Collections::minMax (get object with the lowest ID)
Example of Collections::distinct (get only objects with different IDs)
Example of Collections::sort (sort collection of objects to start from objects with the lowest ID)
Example of Collections::orElse (get collection with objects but replace each one with ID <= 0 to default one)
Example of Collections::reduce (reduce array of objects info arrayof their a bit modified IDs)
Example of Collections::groupBy (group objects by type)
Example of Collections::contains and Collections::search (search elements in a collection or just check if collection contains element)
Example of Collections::collect (predefined collectors)

Examples:


Contract for stream methods (non static ones)

Below interface show full contract of all stream methods can be used.


Contract for static methods

Below interface show full contract of all static methods can be used.

Informations

Curently library needs PHP >= 7.4. Soon it will be redesigned to support also older versions of PHP.

Author - Slawomir Hadas


All versions of php-streams with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
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 hadasbro/php-streams contains the following files

Loading the files please wait ....