Download the PHP package jeremeamia/iter8 without Composer

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

Iter8

Made with Love Coded in PHP Packagist Version CircleCI

Introduction

Iter8 is a PHP library for iterable and functional operations (e.g., map, filter, reduce) implemented using generators.

Iter8 provides ways to create and transform any iterables (e.g., generators, iterators, arrays, etc.) easily in order to deal with data sets that fit the Iterator pattern use case (i.e., typically data of large, paginated, infinite, or unknown length). Using iterators/generators generally provides benefits like lower memory consumption and lazy evaluation. Complex transformations can be defined via functional composition.

Usage

Iter8's core implementations reside as static methods in 3 classes:

There are 3 usage patterns for working with iterable values available in Iter8. Which you use is mostly a matter of preference:

The examples in the next section will demonstrate each of these usage patterns.

Examples

Given the following data set...

Iter Functions

With this usage pattern, operations are applied procedurally and one-at-a-time.

Pipe Composition

With this usage pattern, operations are "piped" or composed together. The Pipe class delegates its operations back to the Iter class, but manages the iterable value.

You can "switch" the context of the iterable you are transforming in the middle of a pipe. This example evaluates the max age from the iterable of people, and then switches to a new iterable using that max age value.

Collection Object

With this usage pattern, the iterable is encapsulated as a Collection object. Calling methods on the collection object delegate back to the Iter class, but the iterable is managed internally. Collections are immutable, so each transformation returns a new instance. Also, unlike regular generators, collections can be rewound. Static method calls on Collection are delegated to Gen, so the Collection object actually exposes the breadth of Iter8's functionality from one interface.

Rewindability

Generators are not rewindable (i.e., calling rewind() on them explicitly or trying foreach them again will cause an error). Iter8 provides two ways to make generators/iterables rewindable.

Deferred Generators

If you are in control of the function that produces the generator (i.e., the one containing the yield statements), then you can use the Gen::defer() function to wrap that generating function.

Gen::defer() returns a DeferredGenerator iterator, that defers producing the actual generator until the time of iteration. If you rewind or iterate again, then the generating function is re-executed.

Rewindable Iterator

If you don't control the generating function or want to avoid re-executing the generator, then you can retroactively make the iterable rewindable by using the Iter::rewindable() function.

Iter::rewindable() wraps the provided iterable in a RewindableIterator, which caches items during the first iteration, such that they can be re-emitted in later iterations.

Also, Collections are rewindable be default, since they extend the RewindableIterator.

Inspiration

A lot of my recent work in PHP has dealt with iterators and generators, and fiddling about with large API result sets, so I wanted to put something like this together to share.

However, some work like this has been done before in libraries like nikic/iter. You'll notice that I have some similar functions and implementations. Some of my work here is inspired by that library, and some is straight borrowed.

In addition, I've taken some inspiration from the ReactiveX project. Though generators and observables are not identical concepts, they are similar, so some of the operations and names of operations have been borrowed when they apply equally well to both generators and observables. Also, the concept of "pipe" from RxJS, the JavaScript implementation of ReactiveX, is implemented in this project for composing transformations. In a way, this is also similar to how the mtdowling/transducers.php library works with its "composable algorithmic transformations". The idea of "transducers" themselves are borrowed from Clojure, so I've looked to several sources for ideas.

Finally, I've also taken ideas from the Laravel Collections library, and though I also have some similar functions, my implementations vary greatly as they are founded upon generators, not arrays. This means that random array access of values in Iter8 collections is not supported.


All versions of iter8 with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 jeremeamia/iter8 contains the following files

Loading the files please wait ....