empaphy / usephul
Provides useful classes and functions that extend the standard functionality of PHP.
v0.3.0
2025-03-04 21:51 UTC
Requires
- php: >=8.1
- empaphy/polyphill-php: ^1
Requires (Dev)
- empaphy/dev: ^1@dev
README
Usephul is a PHP library that provides useful classes and functions that extend the standard functionality of PHP.
Functions
Array Functions
- array_interchange() — Interchange the values of two elements of an array.
- array_remap() — Applies a (generator) callback to the elements of a given array, allowing the remapping of its keys in the process.
- array_zip() — Perform a zip operation on multiple arrays.
Filesystem Functions
- filename() — Returns the name component of path without the extension.
- extension() — Returns the extension component of path without the extension.
Generator Functions
Variable handling Functions
- is_closed_resource() — Finds whether the given variable is a resource that has been closed.
- is_non_empty_string() — Find whether a variable is a non-empty string.
- is_negative_int() — Find whether a variable is an integer and less than zero.
- is_non_negative_int() — Find whether a variable is an integer and not less than zero.
- is_non_positive_int() — Find whether a variable is an integer and not greater than zero.
- is_non_zero_int() — Find whether a variable is an integer and not zero.
- is_number() — Find whether a variable is a number (either an integer or a float).
- is_positive_int() — Find whether a variable is an integer and greater than zero.
- is_zero() — Finds whether the given number is (sufficiently close to) 0.
Trait Functions
- uses() — Checks whether an object or class uses a given trait.
SPL Functions
- class_parents_uses() — Return the traits used by the parent classes of the given class.
- class_parents_traits_uses() — Return the traits used by the parent classes of the given class, recursively.
- class_traits_uses() — Return the traits used by the given class or trait, recursively.
Classes
Filesystem
- PathInfo — Provides information about a file path.
Traits
Enumerations
- EnumDynamicity — Adds dynamicity of case names to PHP Enumerations.