PHPackages                             std/lib - 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. std/lib

ActiveLibrary

std/lib
=======

The new-unofficial standard runtime. The library for the standard library: The most basic of the basic.

0.0.0.1(6y ago)013MIT

Since Sep 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/std-lib/std)[ Packagist](https://packagist.org/packages/std/lib)[ RSS](/packages/std-lib/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

std/lib: unofficial new std runtime kit
=======================================

[](#stdlib-unofficial-new-std-runtime-kit)

`std-lib` is a type-safe collection of helper utilities and safe implementations of several php “core” functions.

For more about the guarantees of `std/lib`, see [the stdlib website](http://std-lib.github.io).

**This library is currently on hold undergoing very basic QA. It should be generally available by the end of September 2019.**

Methods Provided:
-----------------

[](#methods-provided)

### `Std\Str` functions

[](#stdstr-functions)

`Str` is the standard name for the UTF-8 ready string utilities.

### `Std\Arr` functions

[](#stdarr-functions)

`Arr` is the standard name for array utilities (due to `Array` being reserved).

###### `\Std\Arr::callRecursive(array $array, callable $method)`

[](#stdarrcallrecursivearray-array-callable-method)

###### `\Std\Arr::arrayUniqueRecursive(array $array)`

[](#stdarrarrayuniquerecursivearray-array)

###### `\Std\Arr::keyWalk(array $inputArray, callable $fn)`

[](#stdarrkeywalkarray-inputarray-callable-fn)

###### `\Std\Arr::count($array) : array`

[](#stdarrcountarray--array)

​ Counts the value or throws an exception.

###### `\Std\Arr::countAny($arrayOrOther): int`

[](#stdarrcountanyarrayorother-int)

​ Accepts any value, not just countables, returning zero for non-countables and throwing no exception.

###### `\Std\Arr::getColumn($array)`

[](#stdarrgetcolumnarray)

​ Same as `array_column`, but preserves keys and additional type-checks. ​ If the key (column) does not exist within the sub-element, a `Array\MissingKeyException` is thrown. ​ If any of the sub-elements are not arrays, a `Array\UnexpectedElementException` is thrown.

###### \\Std\\Arr::pileByColumn(array $inputArray, string $column) : array`

[](#stdarrpilebycolumnarray-inputarray-string-column--array)

Returns a newly structured array with an additional dimension added, so that the input array

```
    [
      ['id' => 'ipsum', 'a' => '1', 'b' => '2', 'c' => 'charlie'],
      ['id' => 'lorem', 'd' => '4', 'e' => '2', 'f' => 'foxtrot'],  // Note these are both id "lorem"
      ['id' => 'lorem', 'g' => '1', 'h' => '2', 'z' => 'zeta'],     // Note these are both id "lorem"
    ]
```

If "piled" by the column "id", would become:

```
[
	['ipsum'] => [
		['id' => 'ipsum'', ''a' => '1', 'b' => '2', 'c' => 'charlie']
	],
	['lorem'] => [
		['id' => 'lorem', ''d' => '4', 'e' => '2', 'f' => 'foxtrot'],
		['id' => 'lorem', ''g' => '1', 'h' => '2', 'z' => 'zeta'],
	]
]
```

###### \\Std\\Arr::rekeyByColumn(array\[\] $inputArray, string $columnName): array`

[](#stdarrrekeybycolumnarray-inputarray-string-columnname-array)

​ Assuming each element of `$inputArray` is an array, and within it a sub-element with key `$columnName` with a valid key as the value, re-keys the array using that value.
​
​ If the values of these values are not unique, an `LossyOperationException` exception will be thrown.
​ If any of elements aren't an array, a `Array\MissingKeyException` or `Array\UnexpectedElementException` is thrown.

###### `\Std\Arr::rekeyByColumnLossy(array[] $inputArray, string $columnName) : array`

[](#stdarrrekeybycolumnlossyarray-inputarray-string-columnname--array)

​ See `\Std\Arr::rekeyByColumn`, however this allows losses during conversion.

###### `\Std\Arr::columnPopLeft(array[] $inputArray) : array`

[](#stdarrcolumnpopleftarray-inputarray--array)

​ Pops the "left" or "top" (first-most, or lowest-indexed) element off of each sub-array element, returning an array of these values.
​ If any element contains zero elements, `NULL` is returned in it's place.
​ If it is any other type than `array`, `Array\UnexpectedElementException` is thrown.

`\Std\Arr::columnPopLeft(array[] $inputArray) : array`Pops the "right" or "bottom" most element off each sub-array element.

##### Undocumented

[](#undocumented)

###### `\Std\Arr::columnRecursive(Iterable $haystack, ...$subKey)`

[](#stdarrcolumnrecursiveiterable-haystack-subkey)

###### `\Std\Arr::columnSearch(Iterable $haystack, $needle)`

[](#stdarrcolumnsearchiterable-haystack-needle)

###### `\Std\Arr::columnSearchRecursive(Iterable $haystack, $needle)`

[](#stdarrcolumnsearchrecursiveiterable-haystack-needle)

###### `\Std\Arr::combineWith($value, $keyKey, $valueKey, $keyInsensitive = false)`

[](#stdarrcombinewithvalue-keykey-valuekey-keyinsensitive--false)

###### `\Std\Arr::idiff($x, $y)`

[](#stdarridiffx-y)

​ Effectively: array\_unique(array\_merge(array\_intersect($x, $y), array\_intersect($y, $x)));

###### `\Std\Arr::keyEach($array, $callback)`

[](#stdarrkeyeacharray-callback)

###### `\Std\Arr::mapReduce(callable $mapReduceFn, ... $values)`

[](#stdarrmapreducecallable-mapreducefn--values)

###### `\Std\Arr::merge(array $array1, array $array2 = null, array $_ = null)`

[](#stdarrmergearray-array1-array-array2--null-array-_--null)

###### `\Std\Arr::multisort(array $arr, $arg = null, $arg = null, $_ = null)`

[](#stdarrmultisortarray-arr-arg--null-arg--null-_--null)

###### `\Std\Arr::popLeft(array $array)`

[](#stdarrpopleftarray-array)

###### `\Std\Arr::popRight(array $array)`

[](#stdarrpoprightarray-array)

###### `\Std\Arr::push(array $array, ...$vars)`

[](#stdarrpusharray-array-vars)

###### `\Std\Arr::reduce_j(callable $reduceFn, $values)`

[](#stdarrreduce_jcallable-reducefn-values)

###### `\Std\Arr::search($needle, array $haystack, $strict = null)`

[](#stdarrsearchneedle-array-haystack-strict--null)

###### `\Std\Arr::shift(array $array)`

[](#stdarrshiftarray-array)

###### `\Std\Arr::slice(array $array, $offset, $length = null)`

[](#stdarrslicearray-array-offset-length--null)

​ See Also: Std\\List::slice(array $array, $offset, $length = null)

###### `\Std\Arr::splice(array $input, $offset, $length = null, $replacement = null)`

[](#stdarrsplicearray-input-offset-length--null-replacement--null)

###### `\Std\Arr::unshift(array $array, ...$vars)`

[](#stdarrunshiftarray-array-vars)

###### `\Std\Arr::walk(array $array, $funcname, $userdata = null)`

[](#stdarrwalkarray-array-funcname-userdata--null)

###### `\Std\Arr::walkRecursive(array $input, $funcname, $userdata = null)`

[](#stdarrwalkrecursivearray-input-funcname-userdata--null)

###### `\Std\Arr::trim($array)`

[](#stdarrtrimarray)

#### Exceptions

[](#exceptions)

- \\Std\\ExceptionInterface

    - \\Std\\RuntimeException
    - \\Std\\UnexpectedTypeException - For non-typehinted methods
    - \\Std\\UnexpectedValueException
    - \\Std\\UnsafeOperationException
    - \\Std\\InformativeExceptionInterface - Provides user-friendly error message
- \\Std\\Array\\ExceptionInterface

    - Array\\UnexpectedElementException
    - Array\\KeyCollisionException

#### `Std\Introspect`

[](#stdintrospect)

Introspection and internals functions

###### Introspect::getCallableName($callable)

[](#introspectgetcallablenamecallable)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2444d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13ac690f7dcc7b9e3f0bea11ac63032685475b78c7dcfeeaa69b6e64f1c0e5a7?d=identicon)[abcarroll](/maintainers/abcarroll)

---

Top Contributors

[![abcarroll](https://avatars.githubusercontent.com/u/961513?v=4)](https://github.com/abcarroll "abcarroll (1 commits)")

### Embed Badge

![Health badge](/badges/std-lib/health.svg)

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

PHPackages © 2026

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