Iterators - The missing PHP iterators.

Last update: May 3, 2022

Latest Stable Version GitHub stars Total Downloads GitHub Workflow Status Scrutinizer code quality Type Coverage Code Coverage Mutation testing badge License Donate!

PHP Iterators

Description

The missing PHP iterators.

Features

  • CachingIteratorAggregate
  • ClosureIterator: ClosureIterator(callable $callable, array $arguments = [])
  • ClosureIteratorAggregate: ClosureIteratorAggregate(callable $callable, array $arguments = [])
  • IterableIterator: IterableIterator(iterable $iterable)
  • IterableIteratorAggregate: IterableIteratorAggregate(iterable $iterable)
  • PackIterableAggregate
  • UnpackIterableAggregate
  • PausableIteratorAggregate
  • RandomIterableAggregate

Installation

composer require loophp/iterators

Usage

CachingIteratorAggregate

Let you cache any iterator. You then get \Generators rewindable for free.

This implementation does not use internal state to keep track of the current position of the iterator. The underlying mechanism is based on SPL \CachingIterator.

The pros of using that iterator is performance. It's blazing fast, it cannot compare to any other stateful custom implementations.

This iterator will cache keys and values, of any type.

<?php

// Generator
$generator = static function (): \Generator {
    yield true => 'foo';
    yield false => 'bar';
    yield ['foo', 'bar'] => 'foobar';
};

$iterator = new CachingIteratorAggregate($generator());

foreach ($iterator as $key => $value); // This will work.
foreach ($iterator as $key => $value); // This will also work.

PackIterableAggregate

<?php

// Generator
$generator = static function (): \Generator {
    yield true => 'foo';
    yield false => 'bar';
    yield ['foo', 'bar'] => 'foobar';
};

$iterator = new PackIterableAggregate($generator());

foreach ($iterator as $value);
/*
$value will yield the following values:

- [true, 'foo']
- [false, 'bar']
- [['foo', 'bar'], 'foobar']
*/

UnpackIterableAggregate

<?php

// Generator
$generator = static function (): \Generator {
    yield [true, 'foo'];
    yield [false, 'bar'];
    yield [['foo', 'bar'], 'foobar'];
};

$iterator = new UnpackIterableAggregate($generator());

foreach ($iterator as $key => $value);
/*
$key and $value will yield the following values:

- true => 'foo'
- false => 'bar'
- ['foo', 'bar'] => 'foobar'
*/

ClosureIterator

<?php

$callable = static fn (int $from, int $to) => yield from range($from, $to);

$iterator = new ClosureIterator($callable(10, 20));

IterableIterator

<?php

$iterator = new IterableIterator(range(1, 10));

PausableIteratorAggregate

<?php

$inputIterator = new ArrayIterator(range('a', 'e'));
$iteratorAggregate = new PausableIteratorAggregate($inputIterator);

$i = 0;
foreach ($iteratorAggregate as $v) {
    var_dump($v) // Print: 'a', 'b', 'c'
    if (++$i === 2) {
        break;
    }
}

foreach ($iteratorAggregate->rest() as $v) {
    var_dump($v) // Print: 'd', 'e'
}

RandomIterableAggregate

In order to properly use this iterator, the user need to provide an extra parameter seed. By default, this parameter is set to zero and thus, the resulting iterator will be identical to the original one.

Random items are selected by choosing a random integer between zero and the value of seed. If that value is zero, then the iterator will yield else it will skip the value and start again with the next one.

The bigger the seed is, the bigger the entropy will be and the longer it will take to yield random items. It's then up to the user to choose an appropriate value. Usually a good value is twice the approximate amount of items the decorated iterator has.

If you're willing to iterate multiple times on this, use the CachingIteratorAggregate to cache the results.

This iterator works on keys and values, of any type.

<?php

$seed = random_int(0, 1000);
$inputIterator = new ArrayIterator(range('a', 'e'));
$iterator = new RandomIterableAggregate($inputIterator, $seed);

foreach ($iterator as $v) {
    var_dump($v);
}

$iterator = new CachingIteratorAggregate(
    (new RandomIterableAggregate($inputIterator, $seed))->getIterator()
);

foreach ($iterator as $v) {
    var_dump($v);
}
foreach ($iterator as $v) {
    var_dump($v);
}

Code quality, tests, benchmarks

Every time changes are introduced into the library, Github runs the tests.

The library has tests written with PHPUnit. Feel free to check them out in the tests directory.

Before each commit, some inspections are executed with GrumPHP; run composer grumphp to check manually.

The quality of the tests is tested with Infection a PHP Mutation testing framework - run composer infection to try it.

Static analyzers are also controlling the code. PHPStan and PSalm are enabled to their maximum level.

Contributing

Feel free to contribute by sending Github pull requests. I'm quite responsive :-)

If you can't contribute to the code, you can also sponsor me on Github.

Changelog

See CHANGELOG.md for a changelog based on git commits.

For more detailed changelogs, please check the release changelogs.

GitHub

https://github.com/loophp/iterators
Comments
  • 1. Optimize `SimpleCachingIterator`

    This PR:

    • [ ] Fix ...
    • [ ] Provide ...
    • [ ] It breaks backward compatibility
    • [ ] Has unit tests (phpspec)
    • [ ] Has static analysis tests (psalm, phpstan)
    • [ ] Has documentation
    • [ ] Is an experimental thing

    Follows #. Related to #. Fixes #.

    Reviewed by drupol at 2022-01-07 22:26
  • 2. Fix typo in class name

    This PR:

    • [x] Fixes a typo in a class name in the readme
    • [ ] Provide ...
    • [ ] It breaks backward compatibility
    • [ ] Has unit tests (phpspec)
    • [ ] Has static analysis tests (psalm, phpstan)
    • [ ] Has documentation
    • [ ] Is an experimental thing

    Follows #. Related to #. Fixes #.

    Reviewed by jdreesen at 2021-12-22 00:44
  • 3. feat: Add benchmarks.

    Current results:

    PHPBench (1.2.2) running benchmarks...
    with configuration file: /home/pol/dev/git/iterators/phpbench.json
    with PHP version 8.0.13, xdebug ❌, opcache ❌
    
    \benchmarks\loophp\iterators\GeneratorCacheBench
    
        benchIterators # loophp/iterators.......I9 - Mo137.341μs (±10.28%)
        benchIterators # azjezz/psl.............I9 - Mo6.831ms (±3.89%)
    
    Subjects: 1, Assertions: 0, Failures: 0, Errors: 0
    +---------------------+----------------+------------------+------+-----+----------+-----------+---------+
    | benchmark           | subject        | set              | revs | its | mem_peak | mode      | rstdev  |
    +---------------------+----------------+------------------+------+-----+----------+-----------+---------+
    | GeneratorCacheBench | benchIterators | loophp/iterators | 100  | 10  | 6.943mb  | 137.341μs | ±10.28% |
    | GeneratorCacheBench | benchIterators | azjezz/psl       | 100  | 10  | 6.932mb  | 6.831ms   | ±3.89%  |
    +---------------------+----------------+------------------+------+-----+----------+-----------+---------+
    
    Reviewed by drupol at 2021-12-18 18:08
  • 4. chore(deps): Bump actions/stale from 4 to 5

    Bumps actions/stale from 4 to 5.

    Release notes

    Sourced from actions/stale's releases.

    v5.0.0

    Features

    v4.1.0

    Features

    Changelog

    Sourced from actions/stale's changelog.

    Changelog

    Commits
    • 3cc1237 Merge pull request #670 from actions/thboop/node16upgrade
    • 76e9fbc update node version
    • 6467b96 Update default runtime to node16
    • 8af6051 build(deps-dev): bump jest-circus from 27.2.0 to 27.4.6 (#665)
    • 7a7efca Fix per issue operation count (#662)
    • 04a1828 build(deps-dev): bump ts-jest from 27.0.5 to 27.1.2 (#641)
    • 65ca395 build(deps-dev): bump eslint-plugin-jest from 24.4.2 to 25.3.2 (#639)
    • eee276c build(deps-dev): bump prettier from 2.4.1 to 2.5.1 (#628)
    • 6c2f9f3 Merge pull request #640 from dmitry-shibanov/v-dmshib/fix-check-dist
    • 37323f1 fix check-dist.yml
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Reviewed by dependabot[bot] at 2022-04-11 13:45
  • 5. chore(deps): Bump shivammathur/setup-php from 2.18.0 to 2.18.1

    Bumps shivammathur/setup-php from 2.18.0 to 2.18.1.

    Release notes

    Sourced from shivammathur/setup-php's releases.

    2.18.1

    Support Ukraine


    - name: Setup PHP with intl
      uses: shivammathur/[email protected]
      with:
        php-version: '8.1'
        extensions: intl-71.1
    
    • Added support for macOS Monterey (macos-12) GitHub hosted environment.

    • Added support for mcrypt extension using shivammathur/extensions tap on macOS.

    • Fixed patching brew for overwriting existing linked libraries.

    • Fixed identifying the latest protoc release.

    • Updated Node.js dependencies.


    Thanks! @​jderusse for the contributions 🚀

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Reviewed by dependabot[bot] at 2022-04-11 13:45
  • 6. chore(deps): Bump shivammathur/setup-php from 2.17.1 to 2.18.0

    Bumps shivammathur/setup-php from 2.17.1 to 2.18.0.

    Release notes

    Sourced from shivammathur/setup-php's releases.

    2.18.0

    Support Ukraine


    • Added support for installing libraries and custom configure options for PECL extensions. #575. Docs.

    • Added support for blackfire extension on PHP 8.1 on Windows.

    • Improved support for http extension on Windows and self-hosted environments.

    • Fixed installing php-dev package on self-hosted environments when missing. #569

    • Fixed linking pecl ini file on self-hosted environments. #569

    • Fixed copying extensions when installed using brew from its Cellar to extension directory on macOS.

    • Fixed generating extension dependency map.

    • Fixed a bug in log functions on Linux and macOS by using local variables.

    • Improved switching versions on Linux. #572

    • Improved enabling default extensions by reducing PHP calls.

    • Bumped actions/checkout, actions/upload-artifact, actions/download-artifact and actions/cache version in examples and workflows to v3. #571, #577

    • Added PECL customization guide to README.

    • Updated Node.js dependencies.


    Thanks! @​jrfnl for the contributions 🚀

    Commits
    • d37cc30 Update Node.js dependencies
    • 412722b Install libraries on each PECL install if specified
    • c19f6bb Add PECL customization guide to README
    • dfd2c8d Add http dependencies when version is specified
    • 27eef9a #StandWithUkraine
    • f172a4d Merge pull request #577 from jrfnl/feature/update-actions-cache-runner
    • c88ece8 Examples: update the action runner version
    • 33ad931 GH Actions: version update for actions/cache
    • 4e4b26a Suppress output while generating extension map
    • 228bfba Fix copying extensions from cellar to extension directory on macOS
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Reviewed by dependabot[bot] at 2022-03-23 13:50
  • 7. chore(deps): Bump actions/cache from 2.1.7 to 3

    Bumps actions/cache from 2.1.7 to 3.

    Release notes

    Sourced from actions/cache's releases.

    v3.0.0

    • This change adds a minimum runner version(node12 -> node16), which can break users using an out-of-date/fork of the runner. This would be most commonly affecting users on GHES 3.3 or before, as those runners do not support node16 actions and they can use actions from github.com via github connect or manually copying the repo to their GHES instance.

    • Few dependencies and cache action usage examples have also been updated.

    Commits
    • 4b0cf6c Merge pull request #769 from actions/users/ashwinsangem/bump_major_version
    • 60c606a Update licensed files
    • b6e9a91 Revert "Updated to the latest version."
    • c842503 Updated to the latest version.
    • 2b7da2a Bumped up to a major version.
    • deae296 Merge pull request #651 from magnetikonline/fix-golang-windows-example
    • c7c46bc Merge pull request #707 from duxtland/main
    • 6535c5f Regenerated examples.md TOC
    • 3fdafa4 Update GitHub Actions status badge markdown in README.md
    • 341e6d7 Merge branch 'actions:main' into fix-golang-windows-example
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Reviewed by dependabot[bot] at 2022-03-21 12:43
  • 8. chore(deps): Bump shivammathur/setup-php from 2.17.0 to 2.17.1

    Bumps shivammathur/setup-php from 2.17.0 to 2.17.1.

    Release notes

    Sourced from shivammathur/setup-php's releases.

    2.17.1

    This release is possible because of our sponsors ❤️.

    Help setup-php reach its sponsorship goals.

    Sponsor shivammathur


    • Added support for OpenSSL config on Windows. #564 Now setup-php will set the environment variable OPENSSL_CONF pointing to a valid openssl.cnf file on Windows.

    • Added GitHub releases fallback URL for phing.

    • Updated version of sqlsrv and pdo_sqlsrv extensions to 5.10.0 for PHP 7.4 and above.

    • Fixed logs for symfony-cli on failure. #568

    • Fixed setting an environment variable on Windows in self-hosted environments.

    • Fixed a bug in adding a directory to PATH. #562

    • Fixed a minor UUOC shellcheck warning in add_tools.sh.

    • Updated Node.js dependencies.


    Thanks! @​mlocati for adding Set-OpenSSLConf 🚀

    Commits
    • b75c104 Bump version to 2.17.1
    • 94c859a Add GitHub releases fallback URL for phing
    • 293da04 Fix logs for symfony-cli on failure
    • 808396c Fix Add-EnvPATH on self-hosted Windows
    • 7205f47 Update version of sqlsrv and pdo_sqlsrv extensions
    • 7ad352e Add OpenSSL config on Windows
    • 5bf95cd Fix Add-Env in win32.ps1
    • 18f3aba Fix UUOC shellcheck warning
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Reviewed by dependabot[bot] at 2022-03-02 12:28
  • 9. chore(deps): Bump actions/checkout from 2.4.0 to 3

    Bumps actions/checkout from 2.4.0 to 3.

    Release notes

    Sourced from actions/checkout's releases.

    v3.0.0

    • Update default runtime to node16
    Changelog

    Sourced from actions/checkout's changelog.

    Changelog

    v2.3.1

    v2.3.0

    v2.2.0

    v2.1.1

    • Changes to support GHES (here and here)

    v2.1.0

    v2.0.0

    v2 (beta)

    • Improved fetch performance
      • The default behavior now fetches only the SHA being checked-out
    • Script authenticated git commands
      • Persists with.token in the local git config
      • Enables your scripts to run authenticated git commands
      • Post-job cleanup removes the token
      • Coming soon: Opt out by setting with.persist-credentials to false
    • Creates a local branch
      • No longer detached HEAD when checking out a branch
      • A local branch is created with the corresponding upstream branch set
    • Improved layout

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Reviewed by dependabot[bot] at 2022-03-02 12:28
  • 10. chore(deps): Bump shivammathur/setup-php from 2.16.0 to 2.17.0

    Bumps shivammathur/setup-php from 2.16.0 to 2.17.0.

    Release notes

    Sourced from shivammathur/setup-php's releases.

    2.17.0

    This release is possible because of our sponsors ❤️.

    Help setup-php reach its sponsorship goals.

    Sponsor shivammathur


    • Added ini-file input to specify the base php.ini file. Accepts production, development or none. Docs (#450, #469)

    By default the production php.ini is used, you can change it to the development one, or remove it using none.

    - name: Setup PHP
      with:
        php-version: '8.1'
        ini-file: development
    
    - name: Setup PHP
      with:
        php-version: '8.1'
        tools: symfony-cli
    
    - name: Setup PHP
      with:
        php-version: '8.1'
        tools: churn
    
    • Added support for blackfire extension on PHP 8.1.
    - name: Setup PHP
      with:
        php-version: '8.1'
        extensions: blackfire
    
    • Tools pecl, phpize and php-config are now installed by default on Linux. Specifying these in tools input is no longer required.

    • The environment variable COMPOSER_NO_INTERACTION is now set to 1 by default, so using --no-interaction in composer commands is not required. (#547)

    ... (truncated)

    Commits
    • 7854a0c Fix adding composer_bin to PATH
    • a72a638 Fix check in add_path
    • 46c34bb Update Node.js dependencies
    • 948917a Fix to correctly use fallback URL for tools on Windows
    • d9cb143 Add 22.04-jammy and 13-trixie to os_releases.csv config file [skip ci]
    • 0cfde7b Fix adding Import-Module command to the profile in Install-PSPackage
    • ce2a129 Fix output when sudo is installed
    • 78532b1 Fail when runner it set to github on self-hosted environments
    • 8b26e8d Add pear/pecl by default to self-hosted Linux environments
    • 4dc94c2 Refactor utils.fetch to a module and mock it with nock
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Reviewed by dependabot[bot] at 2022-02-09 12:27
  • 11. Minor optimizations

    This PR:

    • [ ] Fix ...
    • [ ] Provide ...
    • [ ] It breaks backward compatibility
    • [ ] Has unit tests (phpspec)
    • [ ] Has static analysis tests (psalm, phpstan)
    • [ ] Has documentation
    • [ ] Is an experimental thing

    Follows #. Related to #. Fixes #.

    Reviewed by drupol at 2022-01-07 06:04
PHP Integrated Query, a real LINQ library for PHP

PHP Integrated Query - Official site What is PINQ? Based off the .NET's LINQ (Language integrated query), PINQ unifies querying across arrays/iterator

May 3, 2022
True asynchronous PHP I/O and HTTP without frameworks, extensions, or annoying code. Uses the accepted Fibers RFC to be implemented into PHP 8.1
True asynchronous PHP I/O and HTTP without frameworks, extensions, or annoying code. Uses the accepted Fibers RFC to be implemented into PHP 8.1

PHP Fibers - Async Examples Without External Dependencies True asynchronous PHP I/O and HTTP without frameworks, extensions, or annoying code behemoth

May 13, 2022
Map nested JSON structures onto PHP classes

JsonMapper - map nested JSON structures onto PHP classes Takes data retrieved from a JSON web service and converts them into nested object and arrays

May 13, 2022
A Collections library for PHP.

A Library of Collections for OO Programming While developing and helping others develop PHP applications I noticed the trend to use PHP's arrays in ne

May 2, 2022
Yet Another LINQ to Objects for PHP [Simplified BSD]

YaLinqo: Yet Another LINQ to Objects for PHP Online documentation GitHub repository Features The most complete port of .NET LINQ to PHP, with many add

May 9, 2022
🗃 Array manipulation library for PHP, called Arrayy!

?? Arrayy A PHP array manipulation library. Compatible with PHP 7+ & PHP 8+ \Arrayy\Type\StringCollection::create(['Array', 'Array'])->unique()->appen

May 8, 2022
`LINQ to Object` inspired DSL for PHP

Ginq Array handling in PHP? Be happy with Ginq! Ginq is a DSL that can handle arrays and iterators of PHP unified. Ginq is inspired by Linq to Object,

Apr 17, 2022
Collections Abstraction library for PHP

Collections Collections Abstraction library for PHP The Collection library is one of the most useful things that many modern languages has, but for so

Dec 27, 2021
A repository with implementations of different data structures and algorithms using PHP

PHP Data Structures and Algorithms Data structure and Algorithm is always important for any programming language. PHP, being one of the most popular l

May 17, 2022
Leetcode for PHP, five questions a week and weekends are updated irregularly
Leetcode for PHP,  five questions a week and weekends are updated irregularly

✏️ Leetcode for PHP why do you have to sleep for a long time ,and naturally sleep after death 联系 说明 由于目前工作主要是 golang,我又新起了一个LeetCode-Go-Week项目,- Leetc

May 26, 2022
JsonMapper - map nested JSON structures onto PHP classes

Takes data retrieved from a JSON web service and converts them into nested object and arrays - using your own model classes.

May 10, 2021
All Algorithms implemented in Php

The Algorithms - PHP All algorithms implemented in Php (for education) These implementations are for learning purposes. They may be less efficient tha

May 22, 2022
A community driven collection of sorting algorithms in PHP

algorithms A community driven collection of sorting algorithms This repository includes a comma separated file that includes 10k numbers between 1 and

May 16, 2022
A package that provides `array_*` like functions for iterators.

The doekenorg/iterator-functions package provides a curated set of array_* like functions for iterators in PHP. This package is built to encourage developers to make more use of Iterators by simplifying common tasks.

Mar 5, 2022
Asynchronous iterators and operators.

pipeline Asynchronous iterators and operators. Installation This package can be installed as a Composer dependency. composer require amphp/pipeline Ve

May 3, 2022
The missing PHP 5.3+ calendar management library.

CalendR CalendR is an Object Oriented Calendar management library on top of PHP5.3+ Date objects. You can use it to deal with all your needs about cal

May 21, 2022
Missing data types for PHP. Highly extendable.
Missing data types for PHP. Highly extendable.

Neverending data validation can be exhausting. Either you have to validate your data over and over again in every function you use it, or you have to rely it has already been validated somewhere else and risk potential problems.

Feb 7, 2022
🍺 The missing package manager for macOS (or Linux)

Homebrew Features, usage and installation instructions are summarised on the homepage. Terminology (e.g. the difference between a Cellar, Tap, Cask an

May 22, 2022
Voyager - The Missing Laravel Admin
Voyager - The Missing Laravel Admin

Voyager - The Missing Laravel Admin Made with ❤️ by The Control Group Website & Documentation: https://voyager.devdojo.com/ Video Tutorial Here: https

May 27, 2022
Voyager - The Missing Laravel Admin
Voyager - The Missing Laravel Admin

Voyager - The Missing Laravel Admin Made with ❤️ by The Control Group Website & Documentation: https://voyager.devdojo.com/ Video Tutorial Here: https

May 23, 2022