salient / utils
The utils package of the Salient toolkit
Requires
- php: >=7.4
- composer-runtime-api: ^2.2
Suggests
- salient/iterators: Required by File::find() and File::pruneDir()
This package is auto-updated.
Last update: 2024-11-14 04:21:27 UTC
README
The utils component of the Salient toolkit
salient/utils
provides a suite of useful utility methods via stateless
classes.
-
Arr
works with arrays and iterables. -
Date
works with date and time values, timezones and intervals. -
Debug
gets caller information by normalising backtrace data. -
Env
retrieves environment variables, loads values from.env
files, and applies values from the environment to the script. -
File
provides methods for filesystem operations that throw exceptions on failure. -
Format
makes data human-readable. -
Get
extracts, converts and generates data. For example:Get::coalesce()
replicates the SQLCOALESCE()
functionGet::code()
improves uponvar_export()
Get::copy()
gets a deep copy of an objectGet::eol()
gets a string's end-of-line sequenceGet::uuid()
generates or converts a UUID
-
Inflect
converts English words to different forms, e.g. from singular to plural. -
Json
provides methods for encoding and decoding JSON data that throw exceptions on failure. -
Package
retrieves information from Composer's runtime API, e.g. the name of the root package. -
Reflect
works with PHP's reflection API. -
Regex
provides methods for working with regular expressions that throw exceptions on failure. -
Str
manipulates strings. For example:Str::expandLeadingTabs()
expands leading tabs to spacesStr::matchCase()
matches the case of one string to anotherStr::ngrams()
gets a string's n-gramsStr::snake()
converts a string to snake_caseStr::splitDelimited()
safely splits strings that contain delimiters
-
Sys
retrieves information about the runtime environment, and provides a handler for exit signals (SIGTERM
,SIGINT
andSIGHUP
). -
Test
performs tests on values.
Documentation
API documentation for salient/utils
tracks the main
branch of
the toolkit's GitHub repository, where further documentation can also
be found.