All functions are namespaced free functions (no classes). Each function uses auto-currying:
when called without the data (last) argument, it returns a Closure. This enables both
direct use and piped use with PHP 8.5's |> operator.
- Data-last convention: Subject is always the last parameter
- Auto-currying via
func_num_args(): Each function checks if data was provided Re\find()/Re\findAll(): Renamed frommatch/matchAllbecausematchis reserved in PHP 8.0+- Zero dependencies: Only PHP stdlib functions used internally
- Namespaced functions:
PipeUtils\Str,PipeUtils\Arr,PipeUtils\Type,PipeUtils\Re,PipeUtils\Fn - Composer
filesautoloading: Since these are functions, not classes
-
pipe()— Compose multiple functions -
tap()— Side effects without breaking chain -
when()— Conditional branching -
always()— Constant function -
identity()— Pass-through
-
trim()— Trim whitespace/characters -
upper()— Uppercase -
lower()— Lowercase -
replace()— Substring replacement -
split()— Split by delimiter -
contains()— Substring check -
startsWith()— Prefix check -
slug()— URL-friendly slug -
truncate()— Truncate with suffix
-
map()— Map over elements -
filter()— Filter elements -
reduce()— Reduce to single value -
pluck()— Extract property from each element -
keyBy()— Key array by property -
groupBy()— Group by property -
flatten()— Flatten nested arrays -
unique()— Unique values -
sort()— Sort with optional comparator
-
toInt()— Convert to int -
toFloat()— Convert to float -
toBool()— Convert to bool -
toString()— Convert to string -
toArray()— Convert to array
-
find()— Match pattern (first match) -
findAll()— Match all occurrences -
replace()— Regex replace -
split()— Split by pattern
- Unit tests for all Fn functions
- Unit tests for all Str functions
- Unit tests for all Arr functions
- Unit tests for all Type functions
- Unit tests for all Re functions
- Integration tests for pipe composition
- Edge case tests (nulls, empty strings, empty arrays)
- Fix all static analysis issues
- Add generic type annotations where needed
- README.md with examples
- CI workflow