PHPackages                             urmaul/rich-types - 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. urmaul/rich-types

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

urmaul/rich-types
=================

Yet another rich types library.

0.3.4(8y ago)0388Apache-2.0PHPPHP &gt;=5.4

Since Jan 9Pushed 8y agoCompare

[ Source](https://github.com/urmaul/rich-types)[ Packagist](https://packagist.org/packages/urmaul/rich-types)[ Docs](https://github.com/urmaul/rich-types)[ RSS](/packages/urmaul-rich-types/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (16)Used By (0)

rich-types
==========

[](#rich-types)

Yet another rich types library. Designed to use fluent interaces with base PHP types.

No Not enough comments, no tests, no release planned. Use it only if you are me brave enough.

While major version is 0 minor version change means backwards incompatible changes. So you should install it with composer like this:

`php composer.phar require urmaul/rich-types '0.3.*'`

[![Build Status](https://camo.githubusercontent.com/cb5a53876698ba676af905251dd1a29c3b01149bc8b9092027a543c02439c558/68747470733a2f2f7472617669732d63692e6f72672f75726d61756c2f726963682d74797065732e737667)](https://travis-ci.org/urmaul/rich-types)

Example
-------

[](#example)

```
use rich\collections\Strings;

$words = Strings::split(' ', $text)->lower()->unique()->values();
```

Supported types
---------------

[](#supported-types)

### Collections

[](#collections)

#### Variables

[](#variables)

Base collection class. Can be passed to `foreach` and `count()`.

- **static from($array)** - creates new collection instance.
- **map($callback)** - performs `array_map` to each item in collection.
- **indexBy($callback)** - maps values to keys using callback.
- **mapKeys(array $replaces, $strict = true)** - replaces collection keys using map array..
- **filter($callback = null)** - performs `array_filter` to each item in collection.
- **diff($array)** - Removes from collection all items that are present in $array using `array_diff`.
- **unique()** - performs `array_unique` to collection.
- **merge($array)** - merges another array to collection.
- **find($callback)** - finds an item by callback function. Returns it's value.
- **reduce($callback, $initial = null)** - performs `array_reduce` to collection. Returns resulting value.
- **count()** - returns items count.
- **value()** - returns collection data preserving keys.
- **values()** - returns collection items as array indexed numerically.
- **asVariables()** - converts collection to `Variables`. Can be used to clone collection.
- **asNumbers()** - converts collection to `Numbers`. Can be used to clone collection.
- **asStrings()** - converts collection to `Strings`. Can be used to clone collection.
- **asObjects()** - converts collection to `Objects`. Can be used to clone collection.

#### Strings

[](#strings)

- **static split($delimiter, $string)** - creates new collection instance by splitting text like `explode` does.
- **static splitList($string)** - creates new collection instance by splitting text wtih comma-separated values.
- **lower()** - makes every string in collection lowercase.
- **trim()** - performs `trim` to each item in collection.
- **replace($search, $replace)** - performs `str_replace` to each item in collection.

#### Numbers

[](#numbers)

- **sum()** - returns collection items sum.

#### Objects

[](#objects)

- **property($property)** - cleates new collection with items picked from objects property.

#### Arrays

[](#arrays)

- **column($columnKey, $indexKey = null)** - returns the values from a single column of the array, identified by the column\_key. Optionally, you may provide an index\_key to index the values in the returned array by the values from the index\_key column in the input array.

    Performs [array\_column](http://php.net/manual/en/function.array-column.php) to collection. If php version is lower than 5.5, [ramsey/array\_column](https://github.com/ramsey/array_column) is used.
- **indexByColumn($columnKey)** - uses the values from a single column of the array as collection keys.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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

Recently: every ~255 days

Total

15

Last Release

3069d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22364b943477de78bf89bb19b5708a93666e38b5f1ad954ded9c656b3c116cb8?d=identicon)[urmaul](/maintainers/urmaul)

---

Tags

collectionstypes

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/urmaul-rich-types/health.svg)

```
[![Health](https://phpackages.com/badges/urmaul-rich-types/health.svg)](https://phpackages.com/packages/urmaul-rich-types)
```

###  Alternatives

[doctrine/collections

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

6.0k430.2M1.4k](/packages/doctrine-collections)[dusank/knapsack

Collection library for PHP

5391.0M25](/packages/dusank-knapsack)[qaribou/immutable.php

Immutable, highly-performant collections, well-suited for functional programming and memory-intensive applications.

345148.0k](/packages/qaribou-immutablephp)[cekurte/environment

A library to get the values from environment variables and process to php data types

5887.0k9](/packages/cekurte-environment)[robertmarney/lara-hierarchial-collections

Transforms flat collections to a nested hierarchy

342.3k](/packages/robertmarney-lara-hierarchial-collections)[bnomei/autoloader-for-kirby

Helper to automatically load various Kirby extensions in a plugin

185.7k2](/packages/bnomei-autoloader-for-kirby)

PHPackages © 2026

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