https://github.com/buttress/collecterator
Generator based PHP Collections
https://github.com/buttress/collecterator
by collections generators php powered
Last synced: 5 months ago
JSON representation
Generator based PHP Collections
- Host: GitHub
- URL: https://github.com/buttress/collecterator
- Owner: buttress
- License: mit
- Created: 2017-03-04T23:03:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-04-12T21:13:49.000Z (about 1 year ago)
- Last Synced: 2025-07-26T02:51:37.117Z (11 months ago)
- Topics: by, collections, generators, php, powered
- Language: PHP
- Size: 44.9 KB
- Stars: 33
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Collecterator: Generator based collections
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-actions]][link-actions]
[![Total Downloads][ico-downloads]][link-downloads]
This library is a fully featured `\Generator` based Collection implementation.
The goal is to provide a memory efficient fast collection implementation that makes it possible to use familiar
collection methods to work with infinite or very large streams.
Our tests were largely copied from [`tightenco/collect`](https://packagist.org/packages/tightenco/collect) with many
modifications added to support the deferred processing you get with `Generators`.
For basic usage, see [the `AllMethods.php` example](examples/AllMethods.php)
## Install
Via Composer
``` bash
$ composer require buttress/collecterator
```
## Usage
``` php
$collection = GeneratorCollection::make([1,2,3]);
$collection->filter(function(int $value) {
return $value % 2;
});
$array = $collection->all();
```
## Change log
Please see [CHANGELOG](https://github.com/buttress/collecterator/releases) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email korvinszanto@gmail.com instead of using the issue tracker.
## Credits
- [Korvin Szanto][link-author]
- [All Contributors][link-contributors]
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/buttress/collecterator.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-actions]: https://img.shields.io/github/actions/workflow/status/buttress/collecterator/test.yml?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/buttress/collecterator.svg?style=flat-square
[link-packagist]: https://packagist.org/packages/buttress/collecterator
[link-actions]: https://github.com/buttress/collecterator/actions
[link-downloads]: https://packagist.org/packages/buttress/collecterator
[link-author]: https://github.com/korvinszanto
[link-contributors]: ../../contributors