PHPackages                             empaphy/usephul - 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. empaphy/usephul

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

empaphy/usephul
===============

Provides useful classes and functions that extend the standard functionality of PHP.

v1.10.4(1mo ago)128.9k↓16.7%[1 issues](https://github.com/empaphy/usephul/issues)1MITPHPPHP &gt;=8.1CI passing

Since Jan 29Pushed 1mo agoCompare

[ Source](https://github.com/empaphy/usephul)[ Packagist](https://packagist.org/packages/empaphy/usephul)[ Docs](https://usephul.empaphy.org/)[ RSS](/packages/empaphy-usephul/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (51)Used By (1)

Usephul
=======

[](#usephul)

[![Static Analysis](https://github.com/empaphy/usephul/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/empaphy/usephul/actions/workflows/static-analysis.yml)[![Unit Tests](https://github.com/empaphy/usephul/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/empaphy/usephul/actions/workflows/unit-tests.yml)[![Code Coverage](https://camo.githubusercontent.com/e14f1297eb56771ec3ce51c34a329a9ed7e4914ff5ea243a0a9d1e2d8f894950/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6465253230436f7665726167652d3130302532352d737563636573733f7374796c653d666c6174)](https://camo.githubusercontent.com/e14f1297eb56771ec3ce51c34a329a9ed7e4914ff5ea243a0a9d1e2d8f894950/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6465253230436f7665726167652d3130302532352d737563636573733f7374796c653d666c6174)

**Usephul** is a PHP library that provides useful classes and functions that extend the standard functionality of PHP.

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
    - [Array Functions](#array-functions)
    - [Attribute Functions](#attribute-functions)
    - [Enumerations](#enumerations)
    - [Error Handling Functions](#error-handling-functions)
    - [Generators](#generators)
    - [Math](#math)
    - [Paths](#paths)
    - [SPL Functions](#spl-functions)
    - [Trait Functions](#trait-functions)
    - [Types](#types)
    - [Variable handling Functions](#variable-handling-functions)

Overview
--------

[](#overview)

### Array Functions

[](#array-functions)

- [array\_exclude()](https://usephul.empaphy.org/packages/Arrays.html#function_array_exclude)— exclude values from an array.
- [array\_extract()](https://usephul.empaphy.org/packages/Arrays.html#function_array_extract)— Extract values from an array.
- [array\_get()](https://usephul.empaphy.org/packages/Arrays.html#function_array_get)— Retrieve an element from an array that can be located several levels deep.
- [array\_interchange()](https://usephul.empaphy.org/packages/Arrays.html#function_array_interchange)— Interchange the values of two elements of an array.
- [array\_key\_types()](https://usephul.empaphy.org/packages/Arrays.html#function_array_key_types)— Inspects the types of keys used in an array.
- [array\_omit()](https://usephul.empaphy.org/packages/Arrays.html#function_array_omit)— Omit keys from an array.
- [array\_pick()](https://usephul.empaphy.org/packages/Arrays.html#function_array_pick)— Pick keys from an array.
- [array\_remap()](https://usephul.empaphy.org/packages/Arrays.html#function_array_remap)— Applies a (generator) callback to the elements of a given array, allowing the remapping of its keys in the process.
- [array\_split()](https://usephul.empaphy.org/packages/Arrays.html#function_array_split)— Split an array by a value.
- [array\_zip()](https://usephul.empaphy.org/packages/Arrays.html#function_array_zip)— Perform a zip operation on multiple arrays.

### Attribute Functions

[](#attribute-functions)

- [applies()](https://usephul.empaphy.org/packages/Types-Attributes.html#function_applies)— Finds whether an attribute has been applied to a given object, class, interface, or trait.

### Control Structures

[](#control-structures)

*Exceptions*:

- [UnhandledFitException](https://usephul.empaphy.org/classes/empaphy-usephul-Control-Exceptions-UnhandledFitException.html)— A base exception for control flow exceptions.

*Functions*:

- [fit()](https://usephul.empaphy.org/packages/Control-Functions.html#function_fit)— Returns the result of the first callback with a parameter type that fits the **subject**.

### Enumerations

[](#enumerations)

- [EnumDynamicity](https://usephul.empaphy.org/classes/empaphy-usephul-Enumerations-EnumDynamicity.html)— Adds dynamicity of case names to PHP Enumerations.

### Error Handling Functions

[](#error-handling-functions)

- [debug\_backtrace\_depth()](https://usephul.empaphy.org/packages/Debug.html#function_debug_backtrace_depth)— Returns the current stack trace depth.

### Generators

[](#generators)

- [seq()](https://usephul.empaphy.org/packages/Generators.html#function_seq)— Sequences a value into a [Generator](https://www.php.net/generators).

### Math

[](#math)

- [greatest()](https://usephul.empaphy.org/packages/Math.html#function_greatest)— Finds the value that is greater than all the other values.
- [least()](https://usephul.empaphy.org/packages/Math.html#function_least)— Finds the value that is less than all the other values.
- [rank()](https://usephul.empaphy.org/packages/Math.html#function_rank)— Returns the ordinal rank for a given value.

### Paths

[](#paths)

*Classes*:

- [PathInfo](https://usephul.empaphy.org/classes/empaphy-usephul-Path-PathInfo.html)— Provides information about a file path.

*Functions*:

- [Path\\basename()](https://usephul.empaphy.org/packages/Paths.html#function_basename)— Returns the trailing name component of a path.
- [Path\\components()](https://usephul.empaphy.org/packages/Paths.html#function_components)— Returns an array of path components for the given path.
- [Path\\directory\_separator()](https://usephul.empaphy.org/packages/Paths.html#function_directory_separator)— Returns the directory separator used in the given path.
- [Path\\dirname()](https://usephul.empaphy.org/packages/Paths.html#function_dirname)— Returns a parent directory's path.
- [Path\\extension()](https://usephul.empaphy.org/packages/Paths.html#function_extension)— Returns the extension component of a path.
- [Path\\extension\_replace()](https://usephul.empaphy.org/packages/Paths.html#function_extension_replace)— Replaces the extension component of a path with something else.
- [Path\\filename()](https://usephul.empaphy.org/packages/Paths.html#function_filename)— Returns the name component of a path without the extension.
- [Path\\suffix()](https://usephul.empaphy.org/packages/Paths.html#function_suffix)— Returns a suffix for a path based on a given set of separators.
- [Path\\suffix\_replace()](https://usephul.empaphy.org/packages/Paths.html#function_suffix_replace)— Replaces a suffix in a path with a new value.

### PCRE Functions

[](#pcre-functions)

- [preg\_escape()](https://usephul.empaphy.org/packages/PCRE.html#function_preg_escape)— Escapes all instances of the given PCRE delimiter character in a raw regular expression pattern.

### SPL Functions

[](#spl-functions)

- [class\_parents\_uses()](https://usephul.empaphy.org/packages/Other-SPL.html#function_class_parents_uses)— Return the traits used by the parent classes of the given class.
- [class\_parents\_traits\_uses()](https://usephul.empaphy.org/packages/Other-SPL.html#function_class_parents_traits_uses)— Return the traits used by the parent classes of the given class, recursively.
- [class\_traits\_uses()](https://usephul.empaphy.org/packages/Other-SPL.html#function_class_traits_uses)— Return the traits used by the given class or trait, recursively.

### Trait Functions

[](#trait-functions)

- [uses()](https://usephul.empaphy.org/packages/Types-Traits.html#function_uses)— Checks whether an object or class uses a given trait.

### Types

[](#types)

*Enums*:

- [Fallback](https://usephul.empaphy.org/classes/empaphy-usephul-Fallback.html)— A unit enum representing an fallback value.

*Constants*:

- [fallback](https://usephul.empaphy.org/packages/Types.html#toc-constants)— An alias to `Fallback::default`, representing a default fallback value.

---

### Variable handling Functions

[](#variable-handling-functions)

- [is\_closed\_resource()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_closed_resource)— Finds whether the given variable is a [resource](https://www.php.net/types.resource) that has been closed.
- [is\_non\_empty\_string()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_non_empty_string)— Find whether a variable is a non-empty string.
- [is\_negative\_int()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_negative_int)— Find whether a variable is an integer and less than zero.
- [is\_non\_negative\_int()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_non_negative_int)— Find whether a variable is an integer and not less than zero.
- [is\_non\_positive\_int()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_non_positive_int)— Find whether a variable is an integer and not greater than zero.
- [is\_non\_zero\_int()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_non_zero_int)— Find whether a variable is an integer and not zero.
- [is\_number()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_number)— Find whether a variable is a number (either an integer or a float).
- [is\_positive\_int()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_positive_int)— Find whether a variable is an integer and greater than zero.
- [is\_zero()](https://usephul.empaphy.org/packages/Types-Variables.html#function_is_zero)— Finds whether the given number is (sufficiently close to) 0.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance69

Regular maintenance activity

Popularity30

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~10 days

Total

41

Last Release

55d ago

Major Versions

v0.6.0 → v1.0.02025-07-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/17518a08933290f58c1665feec25cf0939d1c6413b7b4cc25ef6d965b9fcc473?d=identicon)[Alwin Garside](/maintainers/Alwin%20Garside)

---

Top Contributors

[![AlwinGarside](https://avatars.githubusercontent.com/u/193043?v=4)](https://github.com/AlwinGarside "AlwinGarside (122 commits)")

---

Tags

helper-functionsphpusefulhelpersuseful

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/empaphy-usephul/health.svg)

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

###  Alternatives

[danielstjules/stringy

A string manipulation library with multibyte support

2.4k26.0M191](/packages/danielstjules-stringy)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4875.5M16](/packages/voku-arrayy)[voku/stringy

A string manipulation library with multibyte support

1783.8M19](/packages/voku-stringy)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[browner12/helpers

generic helpers

289676.6k7](/packages/browner12-helpers)[pragmarx/ia-arr

Laravel Illuminate Agnostic Arr

553.6M12](/packages/pragmarx-ia-arr)

PHPackages © 2026

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