PHPackages                             karmabunny/kb - 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. karmabunny/kb

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

karmabunny/kb
=============

Common KB utilities

v4.63.49(1mo ago)05.8k↓44.5%1[5 PRs](https://github.com/Karmabunny/kbphp/pulls)2MITPHPPHP ^7.2|^8CI passing

Since Sep 24Pushed 1mo ago8 watchersCompare

[ Source](https://github.com/Karmabunny/kbphp)[ Packagist](https://packagist.org/packages/karmabunny/kb)[ RSS](/packages/karmabunny-kb/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (30)Versions (128)Used By (2)

Karmabunny Helpers
==================

[](#karmabunny-helpers)

Just a big bunch of your favourite utilities.

Most of these have been repurposed from Sprout.

Add more if you please.

Usage
-----

[](#usage)

Pin it loosely the latest major version.

```
composer require karmabunny/kb:^2
```

Code standard
-------------

[](#code-standard)

### Keep the dependencies to nil.

[](#keep-the-dependencies-to-nil)

If you need them, then it doesn't belong in this library.

### Must support php 7.0.

[](#must-support-php-70)

But feel free to slip in some ponyfills.

### Add the damn tests.

[](#add-the-damn-tests)

Like, even just the happy-cases.

Running tests
-------------

[](#running-tests)

Create tests whenever you can.

Run them like this: `composer test`.

Deprecation path
----------------

[](#deprecation-path)

Mistakes happen (like Copyable) and sometimes you realise that your naming convention is terrible.

So when removing things, first mark them as `@deprecated` this should signal to anyone using the code that it'll disappear in the next *major* version.

As always, when deprecating + removing things always annotate your release tag. Imagine your life depends on getting it all in there. Is that a threat? Maybe.

### Collections

[](#collections)

Models! Models! Models!

Collections extends DataObject with some array-like, virtual, serializable stuff.

Some optional behavioural traits:

- UpdateStrictTrait
- UpdateTidyTrait
- UpdateVirtualTrait
- FieldsTrait
- CachedHelperTrait

### Validators

[](#validators)

Collection extensions:

- Doc Validator
- Rules Validator

Also the Validity class. Yay.

### Loggable

[](#loggable)

Per-class logging utilities. Has logger forwarding. Kinda interesting.

### Jobs

[](#jobs)

Generic type for crons and workers.

### Reflect

[](#reflect)

Some useful reflection things.

### Serialisation

[](#serialisation)

- Json - normalised encode/decode with exceptions
- XML - now with templating
- Enc
- Url

### Security

[](#security)

- secure random - bytes, string!
- hash password
- comparisons

### Time

[](#time)

- utime, microtime as an integer
- time ago
- converting things between DateTime, DateTimeImmutable, DateTimeInterface
- date periods

### Arrays

[](#arrays)

Non-standard or weakly supported things.

- array first
- array last
- fill w/ callback
- find w/ callback
- flatten!
- queries (aka `value()`)
- create map
- normalise keys
- config loader!

The config loader is particular pleasant. It supports both traditional `$config` and modern `return [];` style configs. Combined with `value()` you can recreate `Kohana::config()` with ease.

### Consts

[](#consts)

- HttpStatus
- CountryNames

### UUID

[](#uuid)

for v1, v4, v5 (the good ones)

### Env

[](#env)

Environment loading from system or a config file.

Also `isDocker()` - super handy.

### FnUtils (Wrap)

[](#fnutils-wrap)

Mostly related to `array_map()` and `array_filter()`.

### CSV

[](#csv)

- Importer
- Exporter

### XML/Dom utils

[](#xmldom-utils)

- Parsing
- Validating
- XPath!
- 'expects'

### URL

[](#url)

- Encode + decode
- URL builder

### Shell utilities

[](#shell-utilities)

- Safe cmd args
- Async + sync interfaces

### CLI utilities

[](#cli-utilities)

- text input
- masked input
- invisible input
- question - bool
- options - with key browsing

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance94

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 97.2% 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 ~18 days

Recently: every ~3 days

Total

112

Last Release

31d ago

Major Versions

v1.2.0 → v2.3.02021-03-01

v1.3.0 → v2.4.02021-03-09

v2.36.21 → v3.36.212023-05-01

v3.58.38 → v4.58.382025-11-21

v3.59.38 → v4.60.402026-01-28

PHP version history (2 changes)v2.26.14PHP &gt;=7.0

v3.36.21PHP ^7.2|^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/11b33084210490439a6fb2c0b277e0bf39f8d0e368f20bebb703834003a617df?d=identicon)[karmabunny](/maintainers/karmabunny)

---

Top Contributors

[![gwillz](https://avatars.githubusercontent.com/u/3466850?v=4)](https://github.com/gwillz "gwillz (656 commits)")[![jamiemonksuk](https://avatars.githubusercontent.com/u/25573428?v=4)](https://github.com/jamiemonksuk "jamiemonksuk (11 commits)")[![chris-karmabunny](https://avatars.githubusercontent.com/u/210505?v=4)](https://github.com/chris-karmabunny "chris-karmabunny (5 commits)")[![true-jamie](https://avatars.githubusercontent.com/u/225090584?v=4)](https://github.com/true-jamie "true-jamie (2 commits)")[![benno-truevault](https://avatars.githubusercontent.com/u/247051752?v=4)](https://github.com/benno-truevault "benno-truevault (1 commits)")

---

Tags

collectionsutilitieskbkarmabunny

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/karmabunny-kb/health.svg)

```
[![Health](https://phpackages.com/badges/karmabunny-kb/health.svg)](https://phpackages.com/packages/karmabunny-kb)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k196.2M3.1k](/packages/composer-composer)[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M25.2k](/packages/friendsofphp-php-cs-fixer)[doctrine/collections

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

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

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[ilya/belt

A handful of tools for PHP developers.

71020.9k1](/packages/ilya-belt)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

3014.6M26](/packages/vaimo-composer-patches)

PHPackages © 2026

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