PHPackages                             chris-kruining/utilities - 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. chris-kruining/utilities

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

chris-kruining/utilities
========================

Utilities for PHP 7.1 and up

0.2.32(4y ago)07022[1 issues](https://github.com/chris-kruining/utilities/issues)[2 PRs](https://github.com/chris-kruining/utilities/pulls)1GPL-3.0-or-laterPHPPHP &gt;=7.4.0

Since Jul 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/chris-kruining/utilities)[ Packagist](https://packagist.org/packages/chris-kruining/utilities)[ Docs](https://github.com/chris-kruining/utilities)[ RSS](/packages/chris-kruining-utilities/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (4)Versions (50)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/a1bd09f6881220284f355c328247338b8e1045bb426dd449e662e13c56b79a88/68747470733a2f2f706f7365722e707567782e6f72672f63687269732d6b7275696e696e672f7574696c69746965732f762f737461626c65)](https://packagist.org/packages/chris-kruining/utilities)[![Latest Unstable Version](https://camo.githubusercontent.com/5e49af9766432fa52805b7719ea43c5b483c0fd900eae3d240f05f28228b41b1/68747470733a2f2f706f7365722e707567782e6f72672f63687269732d6b7275696e696e672f7574696c69746965732f762f756e737461626c65)](https://packagist.org/packages/chris-kruining/utilities)[![License](https://camo.githubusercontent.com/192210e16dc975106c6dffca38a14c51e2e9953d133522783269bb050a128c0c/68747470733a2f2f706f7365722e707567782e6f72672f63687269732d6b7275696e696e672f7574696c69746965732f6c6963656e7365)](https://packagist.org/packages/chris-kruining/utilities)[![Maintainability](https://camo.githubusercontent.com/4d0fb10b0e70810d060bf09ec68ee0f6b06db23e0103e6990b95ce15b46afa29/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31303764323033646466363239633866326638662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/chris-kruining/utilities/maintainability)[![Test Coverage](https://camo.githubusercontent.com/094664bca7ffcf5effd9641a0937ade6599f30906aaae59e89e7f6258ffdc71b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31303764323033646466363239633866326638662f746573745f636f766572616765)](https://codeclimate.com/github/chris-kruining/utilities/test_coverage)[![SensioLabsInsight](https://camo.githubusercontent.com/2ad043f21ed7ec180989ff56ec11491977a1c3fcaa54dacfd8671366eade146f/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f31346138373062392d663336342d343033302d393731622d3034386362653139636464352f6d696e692e706e67)](https://insight.sensiolabs.com/projects/14a870b9-f364-4030-971b-048cbe19cdd5)

Utilities
=========

[](#utilities)

some utilities for php, nothing special, nothing new, just to my taste

Installation
============

[](#installation)

installation is simply done via composer `composer require chris-kruining/utilities`

Usage
=====

[](#usage)

The main component of the library is the `Collection` at the moment. The goal of the `Collection` is to provide a object oriented interface for [array functions](http://nl1.php.net/manual/en/ref.array.php). It also has a couple of extra's like method chaining and linq-esc implementation(NOT DONE YET) so that you may interact with the `Collection` as if it was a database table

for example

```
CPB\Utilities\Collections\Collection::from([ 'these', 'are', null, null, 'some', null, 'test', 'values', null ])
  ->filter()
  ->toString(' ');
```

would yield

```
'these are some test values'
```

which is the same as

```
join(' ', array_filter([ 'these', 'are', null, null, 'some', null, 'test', 'values', null ]));
```

I agree, the vannilla way is shorter now but the strength really comes into play when we start adding callbacks and increase the chain length

```
CPB\Utilities\Collections\Collection::from([ 'these', '', '', 'are', null, 'some', null, 'test', '', 'values', '' ])
  ->filter(fn($v) => $v !== null && strlen($v) > 0)
  ->map(fn($k, $v) => $k . '::' . $v)
  ->toString('|');
```

would yield

```
'0::these|1::are|2::some|3::test|4::values'
```

which is the same as

```
$filtered = array_filter(
  [ 'these', '', '', 'are', null, 'some', null, 'test', '', 'values', '' ],
  fn($v) => $v !== null && strlen($v) > 0
);

join('|', array_map(fn($k, $v) => $k . '::' . $v, array_keys($filtered), $filtered));
```

As you can see the collection version maintains readability whereas the vannilla version loses in my opinion it's charm because to achieve a single goal you need to spread it out over multiple variables

Roadmap
=======

[](#roadmap)

- Implement basic features to `Collection`
- Bloat `Collection` with features :P
- Split of features into an inheritance tree
- Split lazy mode from `Collection` into `LazyCollection` and implement PHP's array functions as generators
- Finish inheritance structure
- Implement `LazyCollection`
- (Better) implement the `Queryable` interface in a new class so the `Collection` doesn't become bloated

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 51.7% 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 ~36 days

Recently: every ~19 days

Total

47

Last Release

1594d ago

PHP version history (3 changes)0.0.1PHP &gt;=7.0.0

0.1.0PHP &gt;=7.1.0

0.2.25PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/85769196fb2af272b88c4029de87af8ef15ac398a2688d9fab1b4376a33c805b?d=identicon)[Chris Kruining](/maintainers/Chris%20Kruining)

---

Top Contributors

[![chris-kruining](https://avatars.githubusercontent.com/u/5786905?v=4)](https://github.com/chris-kruining "chris-kruining (155 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (125 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (19 commits)")[![robert-van-de-coolwijk](https://avatars.githubusercontent.com/u/46706756?v=4)](https://github.com/robert-van-de-coolwijk "robert-van-de-coolwijk (1 commits)")

---

Tags

phputilities

### Embed Badge

![Health badge](/badges/chris-kruining-utilities/health.svg)

```
[![Health](https://phpackages.com/badges/chris-kruining-utilities/health.svg)](https://phpackages.com/packages/chris-kruining-utilities)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k447.1M9.1k](/packages/symfony-dependency-injection)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)[limingxinleo/hyperf-utils

Utils for Hyperf.

29136.4k3](/packages/limingxinleo-hyperf-utils)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73147.2k29](/packages/jaxon-php-jaxon-core)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

169.9k](/packages/japanese-date-japanese-date)

PHPackages © 2026

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