The structural backbone of the library.
compose()andpipe()stitch smaller functions into bigger ones; the property accessors bridge arrays and objects with a single API; the combinators (always,ifThen,ifElse,sideEffect) handle common higher-order control flow.
compose returns a Closure you can reuse. pipe takes a value and threads it through immediately.
// Build once, reuse.
$slugify = F\compose('trim', 'strtolower', Str\replaceWith(' ', '-'));
$slugify(' Hello World '); // 'hello-world'
// Immediate — value in, value out.
F\pipe(
' Hello World ',
'trim',
'strtolower',
Str\replaceWith(' ', '-')
); // 'hello-world'composeR / pipeR run callables in reverse order. composeSafe halts on the first null; composeTypeSafe halts on a custom type-check failure.
$users = [
['name' => 'Ada', 'role' => 'admin'],
['name' => 'Bea', 'role' => 'user'],
];
$getName = F\getProperty('name');
$isAdmin = F\propertyEquals('role', 'admin');
array_map($getName, $users); // ['Ada', 'Bea']
array_filter($users, $isAdmin); // [ ['name' => 'Ada', ...] ]pluckProperty follows a nested path. hasProperty is the existence predicate. setProperty is the curried setter. encodeProperty + recordEncoder build a new record from scratch.
$toIntOrZero = F\ifElse(
'is_numeric',
'intval',
F\always(0)
);
$toIntOrZero('42'); // 42
$toIntOrZero('nope'); // 0Also: ifThen (apply a transform only when a predicate matches), sideEffect (run a callable for its side effect and return the input unchanged — great for logging inside a pipeline), invoker (wrap a callable into a uniform Closure).
recordEncoder + encodeProperty building view models from API payloads.composeSafe, composeTypeSafe, and ifElse defaults.