PHPackages                             samlitowitz/php-collection-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. samlitowitz/php-collection-generator

ActiveProject

samlitowitz/php-collection-generator
====================================

A tool to generate PHP collection implementations

2.0.0(1y ago)0221Apache-2.0PHPPHP &gt;=7.4

Since Aug 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/samlitowitz/php-collection-generator)[ Packagist](https://packagist.org/packages/samlitowitz/php-collection-generator)[ RSS](/packages/samlitowitz-php-collection-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (5)Used By (1)

PHP Collection Generator
========================

[](#php-collection-generator)

Generate type-safe PHP collections!

Table of Contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Usage](#usage)
    1. [Configuration](#configuration)
3. [Collection Interfaces and Additional Methods](#collection-interfaces-and-additional-methods)
    1. [Interfaces](#interfaces)
4. [Future Features](#future-features)

Installation
------------

[](#installation)

```
composer require --dev samlitowitz/php-collection-generator
```

Usage
-----

[](#usage)

1. Create a [configuration](#configuration) targeting the type(s) you wish to generate a collection for.
2. Generate the desired collection(s) by running the following command

    ```
    ./vendor/bin/php-collection-generator --config /path/to/php-collection-generator.json generate /path/to/output/dir
    ```

### Configuration

[](#configuration)

A JSON schema for the configuration is available [here](assets/schema/configuration.json). The [`TypeCollection`](src/App/Console/Config/TypeCollection.php) is generated using the example [configuration](example/php-collection-generator.json).

Collection Interfaces and Additional Methods
--------------------------------------------

[](#collection-interfaces-and-additional-methods)

### Interfaces

[](#interfaces)

The generated collection will implement the following interfaces

1. `\Countable`
2. `\Iterator`
3. `\JsonSerializable`

### Additional Methods

[](#additional-methods)

The generated collection includes the following methods in addition to those needed to fulfil the above interfaces

1. `public function toArray(): array`
2. `public function add(\Fully\Qualified\Namespace\Type ...$entities): void`

Future Features
---------------

[](#future-features)

1. Output File Formatting
    1. Configuration options
        1. type-hint member variables
            1. inline
            2. as comment

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~277 days

Total

4

Last Release

534d ago

Major Versions

v1.0.2 → 2.0.02024-11-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/e6d6a1f93b670732d251551067a2e17b9f1a180d164036f0a84896bc95f9edba?d=identicon)[samlitowitz](/maintainers/samlitowitz)

---

Top Contributors

[![samlitowitz](https://avatars.githubusercontent.com/u/4641296?v=4)](https://github.com/samlitowitz "samlitowitz (39 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/samlitowitz-php-collection-generator/health.svg)

```
[![Health](https://phpackages.com/badges/samlitowitz-php-collection-generator/health.svg)](https://phpackages.com/packages/samlitowitz-php-collection-generator)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
