An open API service indexing awesome lists of open source software.

https://github.com/stscoundrel/collection

Typed collection-like arrays for PHP
https://github.com/stscoundrel/collection

collections composer-library php typedarrays

Last synced: 2 months ago
JSON representation

Typed collection-like arrays for PHP

Awesome Lists containing this project

README

        

# Collection

Minmalistic typed arrays/collections for PHP.

There are many collection libraries for PHP, but none exactly like I wanted. Most collection libraries add quite a lot of extra functionality I'm not looking for.

What collection does:
- Simple & lightweight
- Array syntax
- Allow typehinting for array of objects

### Motivation

Typehinting "array" in PHP is not really descriptive. Sometimes its preferable to use collection-like typed arrays. This library provides common parent to make creating these collections less boilerplatey.

### Install

`composer require silvanus/collection`

### Usage

Create your own collection class that extends abstract parent.

```php