PHPackages                             vistik/type-hinted-arrays - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vistik/type-hinted-arrays

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vistik/type-hinted-arrays
=========================

A simple way to create typed collections in PHP - build on Illuminate\\Support\\Collection

v2.0.0(9y ago)18.9kPHPPHP &gt;=7.0.0

Since Feb 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/vistik/type-hinted-arrays)[ Packagist](https://packagist.org/packages/vistik/type-hinted-arrays)[ RSS](/packages/vistik-type-hinted-arrays/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

[![Build Status](https://camo.githubusercontent.com/f73af7797491cbed5038fd9339120ddccfa6cddc3889497c11d71f130b0aa453/68747470733a2f2f7472617669732d63692e6f72672f76697374696b2f747970652d68696e7465642d6172726179732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vistik/type-hinted-arrays)

### What is this?

[](#what-is-this)

This is a very simple way to make arrays type hinted!

`$list = new UserCollection(new User());`

OK

`$list = new UserCollection('User');`

Will throw:

`Vistik\Exception\InvalidTypeException: Item (string) 'User' is not a Vistik\Example\User object!`

### Install

[](#install)

Run `composer require vistik/type-hinted-arrays`

### Use build in Collections for primitives

[](#use-build-in-collections-for-primitives)

Out-of-the-box collections for:

- Booleans
- Integers
- Floats
- Strings
- Emails
- Numbers (float or int)

### Do I have to create a type for each list? Yes, but

[](#do-i-have-to-create-a-type-for-each-list-yes-but)

Look how easy it is:

```
class UserCollection extends TypedCollection{
    protected $type = 'Vistik\Example\User';
}

```

2 simple steps

1. Create a Class eg. `AccountCollection` extend `TypedCollection`
2. Just replace `protected $type = 'Vistik\Example\User';` with your class

or

If the check is more then just a `is_a` check, you can overwrite the function: `isValidItem($item)` in your new Collection class

### Features

[](#features)

- Build upon [Illuminate\\Support\\Collection](https://github.com/illuminate/support)
- Very simple to implement custom Collections

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

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

Total

5

Last Release

3377d ago

Major Versions

v1.0.3 → v2.0.02017-02-11

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/778d5a66387a519744a13323544a11649c3c52bdb7207319c473a4154ce5335f?d=identicon)[vistik](/maintainers/vistik)

---

Top Contributors

[![vistik](https://avatars.githubusercontent.com/u/354169?v=4)](https://github.com/vistik "vistik (50 commits)")

---

Tags

arraytype-hintcollectioncollectionstype hinted

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vistik-type-hinted-arrays/health.svg)

```
[![Health](https://phpackages.com/badges/vistik-type-hinted-arrays/health.svg)](https://phpackages.com/packages/vistik-type-hinted-arrays)
```

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.2k412.9k11](/packages/aimeos-map)[vistik/typed-collections

A simple way to create typed collections in PHP - build on Illuminate\\Support\\Collection

1128.2k5](/packages/vistik-typed-collections)[athari/yalinqo

YaLinqo, a LINQ-to-objects library for PHP

4561.2M5](/packages/athari-yalinqo)[yansongda/supports

common components

211.4M31](/packages/yansongda-supports)[rotexsoft/versatile-collections

A collection package that can be extended to implement things such as a Dependency Injection Container, RecordSet objects for housing database records, a bag of http cookies, or technically any collection of items that can be looped over and whose items can each be accessed using array-access syntax or object property syntax.

186.0k1](/packages/rotexsoft-versatile-collections)

PHPackages © 2026

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