Usephul is a PHP library that provides useful classes and functions that extend the standard functionality of PHP.
- array_exclude() — exclude values from an array.
- array_extract() — Extract values from an array.
- array_get() — Retrieve an element from an array that can be located several levels deep.
- array_interchange() — Interchange the values of two elements of an array.
- array_key_types() — Inspects the types of keys used in an array.
- array_omit() — Omit keys from an array.
- array_pick() — Pick keys from 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_split() — Split an array by a value.
- array_zip() — Perform a zip operation on multiple arrays.
- applies() — Finds whether an attribute has been applied to a given object, class, interface, or trait.
- EnumDynamicity — Adds dynamicity of case names to PHP Enumerations.
- debug_backtrace_depth() — Returns the current stack trace depth.
- greatest() — Finds the value that is greater than all the other values.
- least() — Finds the value that is less than all the other values.
- rank() — Returns the ordinal rank for a given value.
Classes:
- PathInfo — Provides information about a file path.
Functions:
- Path\basename() — Returns the trailing name component of a path.
- Path\components() — Returns an array of path components for the given path.
- Path\directory_separator() — Returns the directory separator used in the given path.
- Path\dirname() — Returns a parent directory's path.
- Path\extension() — Returns the extension component of a path.
- Path\extension_replace() — Replaces the extension component of a path with something else.
- Path\filename() — Returns the name component of a path without the extension.
- Path\suffix() — Returns a suffix for a path based on a given set of separators.
- Path\suffix_replace() — Replaces a suffix in a path with a new value.
- 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.
- uses() — Checks whether an object or class uses a given trait.
Enums:
- Fallback — A unit enum representing an fallback value.
Constants:
- fallback
— An alias to
Fallback::default, representing a default fallback value.
- 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.