Download the PHP package omegaalfa/collection without Composer

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

# πŸš€ PHP Collection Library [![PHP Version](https://img.shields.io/badge/php-%3E%3D8.3-777BB4?style=flat-square&logo=php)](https://php.net/) [![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE) [![Tests](https://img.shields.io/badge/tests-239%20passed-success?style=flat-square)](tests/) [![Coverage](https://img.shields.io/badge/coverage-80.85%25-brightgreen?style=flat-square)](coverage/) [![PHPStan](https://img.shields.io/badge/PHPStan-level%202-blue?style=flat-square)](phpstan.neon) **A powerful, type-safe PHP collection library with eager & lazy evaluation** 🎯 [Features](#-features) β€’ [Installation](#-installation) β€’ [Quick Start](#-quick-start) β€’ [Documentation](#-documentation) β€’ [Examples](#-examples)

✨ Features

### 🎯 **Type-Safe** Full PHPDoc generics support ### ⚑ **Lazy Evaluation** Memory-efficient processing ### πŸ”’ **Immutable** Readonly data structures

πŸ“¦ Installation

Requirements

Requirement Version Note
PHP >= 8.3 Required
PHP >= 8.4 Recommended for LazyProxyObject

🎯 Core Concepts

Class Type Purpose Use Case
Collection Generic Iterator wrapper with transformations βœ… Mixed data, legacy code, Iterator support
Sequence Eager Ordered immutable list βœ… Small lists, type safety, immutability
Map Eager Immutable key-value dictionary βœ… Small maps, type safety, immutability
LazySequence Lazy Generator-based pipeline βœ… Large datasets, streaming, memory efficiency
LazyMap Lazy Lazy value computation βœ… Expensive computations, caching, DI
LazyFileIterator Lazy File streaming (JSON lines) βœ… Large files, memory constraints
LazyProxyObject Lazy PHP 8.4+ lazy object instantiation βœ… Expensive objects, service containers

οΏ½ Quick Start

πŸ’‘ Collection - Generic Wrapper

Click to expand

πŸ“‹ Sequence - Ordered Immutable List

Click to expand

πŸ—ΊοΈ Map - Immutable Key-Value Dictionary

Click to expand

⚑ LazySequence - Generator-Based Pipeline

Click to expand

🎯 LazyMap - Lazy Value Computation

Click to expand

πŸ“ LazyFileIterator - Stream Large Files

Click to expand

🎯 Choosing the Right Class

### Use **Collection** πŸ’‘ - βœ… Working with `Iterator` instances - βœ… Need array-like access (`ArrayAccess`) - βœ… Want both eager and lazy methods - βœ… Migrating legacy code ### Use **Sequence** πŸ“‹ - βœ… Need ordered list (0-indexed) - βœ… Want immutability - βœ… Working with small-to-medium datasets - βœ… Type safety is important ### Use **Map** πŸ—ΊοΈ - βœ… Need key-value pairs - βœ… Want immutability - βœ… Working with configuration, dictionaries - βœ… Type safety is important ### Use **LazySequence** ⚑ - βœ… Large datasets (millions of items) - βœ… Memory is constrained - βœ… Need pipeline composition - βœ… Can benefit from short-circuit evaluation ### Use **LazyMap** 🎯 - βœ… Values are expensive to compute - βœ… Not all values will be accessed - βœ… Need lazy initialization - βœ… Dependency injection containers ### Use **LazyFileIterator** πŸ“ - βœ… Processing large JSON line files - βœ… Cannot load entire file in memory - βœ… Streaming data processing

οΏ½ API Reference

πŸ”₯ Core Methods - Quick Reference ### πŸ”„ Transformation ### πŸ“Š Aggregation ### πŸ” Retrieval ### ⚑ Lazy Operations
πŸ“‹ Full Method Compatibility Matrix | Method | Collection | Sequence | Map | LazySequence | LazyMap | |--------|:----------:|:--------:|:---:|:------------:|:-------:| | `map` | βœ… | βœ… | βœ… | βœ… | βœ… | | `filter` | βœ… | βœ… | βœ… | βœ… | βœ… | | `reduce` | βœ… | βœ… | βœ… | βœ… | βœ… | | `take` | βœ… | βœ… | βœ… | βœ… | βœ… | | `skip` | βœ… | βœ… | βœ… | βœ… | βœ… | | `chunk` | βœ… | βœ… | βœ… | βœ… | βœ… | | `sort` | βœ… | βœ… | ❌ | βœ… | ❌ | | `reverse` | βœ… | βœ… | ❌ | βœ… | ❌ | | `unique` | βœ… | βœ… | ❌ | βœ… | ❌ | | `merge` | βœ… | βœ… | βœ… | βœ… | βœ… | | `keys` | βœ… | ❌ | βœ… | ❌ | βœ… | | `values` | βœ… | βœ… | βœ… | βœ… | βœ… | | `mapKeys` | ❌ | ❌ | βœ… | ❌ | βœ… | | `mapValues` | ❌ | ❌ | βœ… | ❌ | βœ… |

πŸ“– Complete documentation: docs/API.md β€’ 150+ methods documented


⚑ Performance & Optimization

πŸ’Ύ Memory Efficiency

#### Traditional Approach ❌ **Result:** ~400 MB | ~850ms #### Lazy Evaluation βœ… **Result:** ~2 MB | ~0.7ms πŸš€ **2290x FASTER!**

πŸ“Š Benchmark Results

View Detailed Benchmarks **Operation:** `map β†’ filter β†’ take(100)` | Implementation | Time | Memory | vs Array | |----------------|------|--------|----------| | Array | 850ms | 400 MB | baseline | | Collection | 820ms | 380 MB | 1.04x faster | | LazySequence | 12ms | 2 MB | **70x faster** | | LazyFileIterator | 8ms | 1 MB | **106x faster** |

🎯 Lazy vs Eager Trade-offs

Scenario Use Lazy ⚑ Use Eager πŸƒ
Large datasets (100k+) βœ… Memory efficient ❌ High memory
Expensive operations βœ… Deferred execution ❌ Upfront cost
Short-circuit (take, first) βœ… Early termination ❌ Full processing
Multiple transformations βœ… Single-pass ❌ Multiple passes
Small datasets (<1k) ❌ Overhead βœ… Fast
Random access ❌ Must materialize βœ… Direct access

πŸ” Detailed analysis: docs/PROFILING_ANALYSIS.md


πŸ§ͺ Testing

### πŸ“Š Code Quality Metrics | Metric | Value | Status | |--------|-------|--------| | **Tests** | 239 tests | βœ… | | **Assertions** | 374 assertions | βœ… | | **Line Coverage** | 80.85% | βœ… | | **Method Coverage** | 76.92% | βœ… | | **PHPStan Level** | Max (9) | βœ… |

πŸ“– Documentation

### πŸ“˜ Core Documentation - [Complete API Reference](docs/API.md) - [LazyFileIterator Guide](docs/LazyFileIterator_README.md) - [Performance Profiling](docs/PROFILING_ANALYSIS.md) ### πŸ’‘ Examples & Guides - [Complete Usage Examples](examples/COMPLETE_USAGE_EXAMPLES.php) - [Examples Directory](examples/) - [Changelog](CHANGELOG.md)

πŸ† Benchmark

Run the included benchmark script:

Sample Output

πŸ—οΈ Architecture

πŸ“ Class Hierarchy & Design Patterns ### 🎨 Design Principles
#### βœ… Core Principles - **Immutability:** All transformations return new instances - **Lazy Evaluation:** Defer computation until needed - **Type Safety:** Full PHPDoc generics support - **Interface Contracts:** Clear API boundaries #### 🌟 Inspired By - [Never Use Arrays (Larry Garfield)](https://www.garfieldtech.com/blog/never-use-arrays) - Scala/Kotlin Collections - Java Streams API - Rust Iterators

πŸ“„ License

This project is licensed under the **MIT License** See the [LICENSE](LICENSE) file for details

🀝 Contributing

**Contributions are welcome!** πŸŽ‰

πŸ“ How to Contribute

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch

  3. βœ… Ensure all tests pass

  4. πŸ“ Commit your changes

  5. πŸ“€ Push to the branch

  6. πŸŽ‰ Open a Pull Request

πŸ“‹ Contribution Guidelines

Requirement Description
βœ… Tests All tests must pass (composer test)
βœ… PHPStan Level 9 compliance required
βœ… Coverage Maintain >75% code coverage
βœ… PSR-12 Follow PHP coding standards
βœ… Conventional Commits Use semantic commit messages

πŸ’¬ Support & Community

| Channel | Link | Description | |---------|------|-------------| | πŸ› **Issues** | [GitHub Issues](https://github.com/omegaalfa/collection/issues) | Bug reports & feature requests | | πŸ’‘ **Discussions** | [GitHub Discussions](https://github.com/omegaalfa/collection/discussions) | Questions & ideas | | πŸ“§ **Email** | [email protected] | Direct support | | πŸ“– **Docs** | [Documentation](docs/) | Complete guides |

### ⭐ Star History [![Star History Chart](https://api.star-history.com/svg?repos=omegaalfa/collection&type=Date)](https://star-history.com/#omegaalfa/collection&Date) --- **Made with ❀️ by the Omegaalfa Team** ⭐ **Star this repo** if you find it useful! [πŸ“– Documentation](docs/) β€’ [πŸ’‘ Examples](examples/) β€’ [πŸ“ Changelog](CHANGELOG.md) β€’ [πŸ“„ License](LICENSE)

All versions of collection with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
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 omegaalfa/collection contains the following files

Loading the files please wait ...