Download the PHP package rikudou/iterables without Composer

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

A simple set of functions that reimplement PHP's built-in array functions but optimize memory usage by using Generators. These functions also accept any iterable, not just arrays, making them more flexible when working with large datasets or data streams.

So, these two are equivalent:

The difference is mainly with other iterables:

In the above case there's not really much difference (except that you can feed results from methods returning iterable directly and avoid unnecessary code), but imagine there's a billion rows instead of 3. And imagine it's a complex object from the database, not an integer.

Note that some of the functions need to traverse the whole iterable, so you don't gain any memory advantages, but you can still feed any iterable into it directly, which is nice.

Function list

Rewindable and cacheable generators

There are two helper objects, RewindableGenerator and CacheableGenerator. Both solve the issue of iterating over a Generator multiple times in a different way.

RewindableGenerator iterates over the generator over and over, while CacheableGenerator only traverses it once and afterwards caches the values in memory.

RewindableGenerator is more useful when working with large datasets, because it only ever holds one item in memory. It accepts a callable argument which will be called every time the original generator is exhausted.

CacheableGenerator accepts the Generator object directly and is useful if you don't care about all the values being held in memory at once. It's more memory-efficient if you potentially don't iterate over the whole object.

Examples

Rewindable generator

When ran, this is the result:

Cacheable generator

Note: The CacheableGenerator stores data either using the ds extension or an internal fallback class. While the fallback class works, it is not as optimized. For better performance, it's highly recommended to install the ds extension. No additional configuration is needed—the generator will automatically use the ds extension if it's available.

When ran, this is the result:


All versions of iterables with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 rikudou/iterables contains the following files

Loading the files please wait ....