PHPackages                             h-util/belt - 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. h-util/belt

ActiveLibrary

h-util/belt
===========

A handful of tools for PHP developers.

2.1.1(11y ago)03MITPHPPHP &gt;=5.4.0

Since Apr 12Pushed 6y agoCompare

[ Source](https://github.com/471207225/belt)[ Packagist](https://packagist.org/packages/h-util/belt)[ RSS](/packages/h-util-belt/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

Belt
====

[](#belt)

[![Build Status](https://camo.githubusercontent.com/fec3a6c396b1b7bf828aa3ee9ad68479f434e4b3edd5d4e7a065eebc31f34c75/68747470733a2f2f7472617669732d63692e6f72672f696c79612d6465762f62656c742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ilya-dev/belt)

A handful of tools for PHP developers.

> Version **2.0.0** is out now. Clear documentation, improved tests and code quality.

Installation
------------

[](#installation)

In case you want to try it out, run:

`php composer.phar require "h-util/belt:~2"`

That will add Belt to your project as a Composer dependency.

Example
-------

[](#example)

A little taste of Belt:

```
use Belt\Belt;

Belt::max([1, 2, 3]) // => 3

Belt::flatten([1, [2, [3]]]) // => [1, 2, 3]

Belt::last([1, 2, 3], 2) // => [2, 3]
```

What It Offers
--------------

[](#what-it-offers)

- **60+** useful functions that you can use in your projects.
- Belt is fully tested.
- The source code is clean and documented.

Here is what is available to you:

- `boolean isDate(mixed $value)`
- `boolean isNumber(mixed $value)`
- `boolean isString(mixed $value)`
- `boolean isFunction(mixed $value)`
- `boolean isEmpty(mixed $value)`
- `boolean isEqual(mixed $left, mixed $right)`
- `boolean isBoolean(mixed $value)`
- `boolean isObject(mixed $value)`
- `boolean isArray(mixed $value)`
- `boolean isTraversable(mixed $value)`
- `boolean isNull(mixed $value)`
- `boolean has(mixed $object, string $key)`
- `array keys(mixed $object)`
- `array values(mixed $object)`
- `array methods(mixed $object)`
- `mixed copy(mixed $value)`
- `mixed extend(mixed $source, mixed $destination)`
- `mixed apply(mixed $object, Closure $closure)`
- `mixed defaults(mixed $object, array|mixed $defaults)`
- `string escape(string $string)`
- `string id(string $prefix = '')`
- `mixed with(mixed $value)`
- `void times(integer $number, Closure $closure)`
- `mixed cache(Closure $closure)`
- `mixed wrap(Closure $closure, Closure $wrapper)`
- `mixed compose(array $closures, array $arguments = array())`
- `void once(Closure $closure)`
- `mixed after(integer $number, Closure $closure)`
- `mixed|array first(array $elements, integer $amount = 1)`
- `array initial(array $elements, integer $amount = 1)`
- `array rest(array $elements, integer $index = 1)`
- `mixed|array last(array $elements, integer $amount = 1)`
- `array pack(array $elements)`
- `array flatten(array $elements)`
- `array range(integer $to, integer $from = 0, integer $step = 1)`
- `array difference(array $one, array $another)`
- `array unique(array $elements, Closure $iterator = null)`
- `array without(array $elements, array $ignore)`
- `array zip(array $one, array $another)`
- `integer indexOf(array $elements, mixed $element)`
- `array intersection(array $one, array $another)`
- `array union(array $one, array $another)`
- `void each(array $collection, Closure $iterator)`
- `array map(array $collection, Closure $iterator)`
- `array toArray(mixed $value)`
- `integer|null size(array|Countable $value)`
- `array shuffle(array $collection)`
- `boolean any(array $collection, Closure $iterator)`
- `boolean all(array $collection, Closure $iterator)`
- `array reject(array $collection, Closure $iterator)`
- `array pluck(array $collection, string $key)`
- `boolean contains(array $collection, mixed $value)`
- `array invoke(array $collection, string $function)`
- `mixed reduce(array $collection, Closure $iterator, mixed $initial = 0)`
- `array sortBy(array $collection, Closure $iterator)`
- `array groupBy(array $collection, Closure $iterator)`
- `mixed max(array $collection)`
- `mixed min(array $collection)`

Development
-----------

[](#development)

### Plans

[](#plans)

- Add `PHP 5.6` support - leverage **variadic functions**.

### Features

[](#features)

- **Collections** \[done\]
    - each \[done\]
    - map \[done\]
    - reduce \[done\]
    - max \[done\]
    - min \[done\]
    - size \[node\]
    - toArray \[done\]
    - groupBy \[done\]
    - sortBy \[done\]
    - shuffle \[done\]
    - all \[done\]
    - any \[done\]
    - pluck \[done\]
    - contains \[done\]
    - invoke \[done\]
    - reject \[done\]
- **Arrays** \[done\]
    - first \[done\]
    - initial \[done\]
    - rest \[done\]
    - last \[done\]
    - pack \[done\]
    - flatten \[done\]
    - without \[done\]
    - unique \[done\]
    - union \[done\]
    - difference \[done\]
    - zip \[done\]
    - intersection \[done\]
    - range \[done\]
    - indexOf \[done\]
- **Functions** \[done\]
    - cache \[done\]
    - once \[done\]
    - wrap \[done\]
    - after \[done\]
    - compose \[done\]
- **Objects** \[done\]
    - keys \[done\]
    - values \[done\]
    - copy \[done\]
    - extend \[done\]
    - defaults \[done\]
    - methods \[done\]
    - apply \[done\]
    - has \[done\]
    - isEqual \[done\]
    - isEmpty \[done\]
    - isObject \[done\]
    - isArray \[done\]
    - isTraversable \[done\]
    - isFunction \[done\]
    - isString \[done\]
    - isNumber \[done\]
    - isBoolean \[done\]
    - isDate \[done\]
    - isNull \[done\]
- **Utilities** \[done\]
    - with \[done\]
    - times \[done\]
    - id \[done\]
    - escape \[done\]

License
-------

[](#license)

Belt is licensed under the MIT license.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.9% 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 ~6 days

Total

7

Last Release

4377d ago

Major Versions

0.1.0 → 1.0.02014-04-13

1.1.1 → 2.0.02014-05-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/b448be5399b3a4a596f37c99c7d4bab56d4f4a60474fd44bb95d8b74d4f3f80b?d=identicon)[471207225](/maintainers/471207225)

---

Top Contributors

[![ilya-dev](https://avatars.githubusercontent.com/u/6959318?v=4)](https://github.com/ilya-dev "ilya-dev (140 commits)")[![dbaymax](https://avatars.githubusercontent.com/u/16485123?v=4)](https://github.com/dbaymax "dbaymax (4 commits)")[![bladeofsteel](https://avatars.githubusercontent.com/u/296507?v=4)](https://github.com/bladeofsteel "bladeofsteel (1 commits)")[![OwlyCode](https://avatars.githubusercontent.com/u/1631270?v=4)](https://github.com/OwlyCode "OwlyCode (1 commits)")

---

Tags

phpcollectionsfunctionstoolsutilitiesarraysobjects

### Embed Badge

![Health badge](/badges/h-util-belt/health.svg)

```
[![Health](https://phpackages.com/badges/h-util-belt/health.svg)](https://phpackages.com/packages/h-util-belt)
```

###  Alternatives

[ilya/belt

A handful of tools for PHP developers.

71020.8k1](/packages/ilya-belt)

PHPackages © 2026

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