PHPackages                             henzeb/laravel-typed-collection - 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. [Database &amp; ORM](/categories/database)
4. /
5. henzeb/laravel-typed-collection

ActiveLibrary[Database &amp; ORM](/categories/database)

henzeb/laravel-typed-collection
===============================

Laravel typed collections

v1.13.0(1y ago)71.7k↓63.8%2[1 issues](https://github.com/henzeb/laravel-typed-collection/issues)[1 PRs](https://github.com/henzeb/laravel-typed-collection/pulls)AGPL-3.0-onlyPHPPHP ^8.1CI passing

Since Jun 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/henzeb/laravel-typed-collection)[ Packagist](https://packagist.org/packages/henzeb/laravel-typed-collection)[ Docs](https://github.com/henzeb/laravel-typed-collection)[ RSS](/packages/henzeb-laravel-typed-collection/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (8)Versions (19)Used By (0)

Laravel Typed Collection
========================

[](#laravel-typed-collection)

[![Build Status](https://github.com/henzeb/laravel-typed-collection/workflows/tests/badge.svg)](https://github.com/henzeb/laravel-typed-collection/actions)[![Latest Version on Packagist](https://camo.githubusercontent.com/bb59c6ba42012264ae311a42d7ca1bbe1ccc47d1dba02379acd4812a1d57a344/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68656e7a65622f6c61726176656c2d74797065642d636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/henzeb/laravel-typed-collection)[![Total Downloads](https://camo.githubusercontent.com/6f80102ea47d364cd6e0366d09dac35e7c0e2a362c0541c6bb301a24cdf6ec67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68656e7a65622f6c61726176656c2d74797065642d636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/henzeb/laravel-typed-collection)[![License](https://camo.githubusercontent.com/0033d85e0bb21eeb650f9f2048913c6b5d95df9f17a333865d0f1e353824586a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f68656e7a65622f6c61726176656c2d74797065642d636f6c6c656374696f6e)](https://packagist.org/packages/henzeb/laravel-typed-collection)

PHP has no support for Generics. Yet sometimes, we want to be sure we receive an array of a certain type.

Using Laravel's Collections, we should be able to force types. This package allows you to.

Unlike many other packages, this one has support for [Eloquent](#typed-collections-in-eloquent)!

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

[](#installation)

Just install with the following command.

```
composer require henzeb/laravel-typed-collection
```

usage
-----

[](#usage)

- [Generic Typed Collections](docs/generic.md)
- [Returnable Typed Collections](docs/returnable.md)
    - [Returnable Lazy Typed Collections](docs/returnable.md#lazy-collections)
    - [Discarding Invalid Types](docs/returnable.md#discarding-invalid-types)
- [Types and Collections](docs/types.md)
    - [Custom Generic Types](docs/types.md#custom-generic-types)
- [Helper Methods](docs/helpers.md)
- [Casting](docs/casting.md)
- [Eloquent](docs/eloquent.md)

Testing this package
--------------------

[](#testing-this-package)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Henze Berkheij](https://github.com/henzeb)

License
-------

[](#license)

The GNU AGPLv. Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance44

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~45 days

Recently: every ~162 days

Total

17

Last Release

393d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15928532?v=4)[henzeb](/maintainers/henzeb)[@henzeb](https://github.com/henzeb)

---

Top Contributors

[![henzeb](https://avatars.githubusercontent.com/u/15928532?v=4)](https://github.com/henzeb "henzeb (21 commits)")

---

Tags

typelaravelsafeeloquentcollectioncollectionsgenerictype-safetypedtypesafehenzebgenerics

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/henzeb-laravel-typed-collection/health.svg)

```
[![Health](https://phpackages.com/badges/henzeb-laravel-typed-collection/health.svg)](https://phpackages.com/packages/henzeb-laravel-typed-collection)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.7k](/packages/illuminate-database)[webparking/laravel-type-safe-collection

This package provides type-safe extension of the laravel collection, forcing a single type of object.

378.2k](/packages/webparking-laravel-type-safe-collection)[gamez/typed-collection

Type-safe collections based on Laravel Collections

45362.9k](/packages/gamez-typed-collection)[esensi/model

The base model traits of Esensi

20067.0k1](/packages/esensi-model)[typicms/nestablecollection

A Laravel Package that extends Collection to handle unlimited nested items following adjacency list model.

88337.7k26](/packages/typicms-nestablecollection)[henzeb/enumhancer

Your framework-agnostic Swiss Army knife for PHP 8.1+ native enums

70367.8k2](/packages/henzeb-enumhancer)

PHPackages © 2026

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