PHPackages                             majesko/fp-kit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. majesko/fp-kit

ActiveLibrary

majesko/fp-kit
==============

Small functional programming utilities for PHP (pipe/compose, Result, Option, Validation).

1.0.0(5mo ago)00MITPHPPHP ^8.2CI passing

Since Dec 19Pushed 5mo agoCompare

[ Source](https://github.com/Majesko/fp-kit)[ Packagist](https://packagist.org/packages/majesko/fp-kit)[ RSS](/packages/majesko-fp-kit/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

majesko/fp-kit
==============

[](#majeskofp-kit)

A lightweight functional programming toolkit for PHP 8.2+. This library provides immutable data types, function composition utilities, and array helpers that enable a clean functional programming style in PHP.

Features
--------

[](#features)

- **Monadic Types**: `Result`, `Option`, and `Validation` for safe, composable error handling
- **Function Composition**: `pipe`, `compose`, `tap`, and `partial` for building complex operations
- **Array Utilities**: Functional helpers like `map`, `filter`, `reduce`, `groupBy`, and `indexBy`
- **Zero Dependencies**: Pure PHP with no external dependencies
- **Fully Typed**: Strict types throughout with PHPStan level 7 compliance
- **Comprehensive Tests**: 79 tests with extensive edge case coverage

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Function Composition](#function-composition)
    - [pipe](#pipe)
    - [compose](#compose)
    - [tap](#tap)
    - [partial](#partial)
- [Array Functions](#array-functions)
- [Result Type](#result-type)
- [Option Type](#option-type)
- [Validation Type](#validation-type)
- [API Reference](#api-reference)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)

Installation
------------

[](#installation)

```
composer require majesko/fp-kit
```

Requires PHP 8.2 or higher.

Quick Start
-----------

[](#quick-start)

```
