Download the PHP package spencerwi/lazylist without Composer

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

PHP-LazyList

A lazy-list (or generator, or fused-stream, or seq, or whatever) library for PHP.

Supports PHP >=7.4.

Usage

Creation

Lazy lists can be created from arrays

They can also be created from callables that take an int index and return either some value or else \Spencerwi\Lazy_list\LazyList::STOP_ITERATION to signal the end of the list.

map

You can map over a lazy list, and it's a "lazy" map, so it doesn't call your mapper function until you actually force evaluation of the list.

filter

You can apply a filter predicate to a lazy list, and it'll "lazily" apply the filter, meaning that your filter function doesn't get called until you actually force evaluation of the list.

Iteration

You can also iterate over a lazy list more traditionally; it's an iterator.

It even supports index => value iteration:

take($count)

You can also take just a certain number of elements from the beginning:

toArray()

You can more directly dump the whole list out to an array with toArray():

BE VERY CAREFUL WITH THIS, as you can wind up using a generator to create an infinite list (if your generator never returns null), which will cause an infinite loop if you call toArray() on it. Unfortunately, there's no way to know ahead of time that a generator is infinite, or else we'd have the list throw an exception on trying to toArray() an infinite LazyList.

reduce()

Alongside map, you also have its friend reduce, which takes an initial value, and a function that works "pairwise" along the list calling a function you provide, first on initial and the first element, then on the previous result and the second element, then on that result and the third element, and so on.

If you try to "reduce" an empty list, you just get the "initial" value back. That's why it's there.

THIS OPERATION IS "EAGER", meaning that it evaluates the whole list. As with toArray(), that means that if you have an infinite LazyList, reduce() will cause an infinite loop.


All versions of lazylist with dependencies

PHP Build Version
Package Version
Requires php Version >7.4.0
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 spencerwi/lazylist contains the following files

Loading the files please wait ....