Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

phunctional

> 数据库
Open source

⚡️ λ PHP functional library focused on simplicity and performance

364 stars0 likes1 views
WebsiteGitHub

About

⚡️ λ PHP functional library focused on simplicity and performance

Phunctional, because functional programming matters.

Lambdish's Phunctional is a little library that tries to bring to PHP some aspects of functional programing with util high order functions and functions for manage iterables.

About

Phunctional is heavily inspired by Clojure and some other PHP libraries like iter, compose and felpado.

The main principles that we have in mind developing this library are:

  • A collection can be any iterable PHP object, arrays or generators
  • Favor composition vs inheritance
  • Be lazy when you can
  • Avoid state, state is (usually) evil!
  • Simplicity over easiness
  • Break the above rules if it makes sense

All of this can be resumed with a word: Immutability.

Installation

To install it with composer:

composer require lambdish/phunctional

Simple usage

The first is to import every function you're going to use, for example:

php
use function Lambdish\phunctional\map;

And then you'll be able to use it:

php
map(
    function ($number) {
        return $number + 10;
    },
    [1, 2, 3, 4, 5]
);

// => [11, 12, 13, 14, 15]

And do something more complex like:

php
use function Lambdish\Phunctional\pipe;
use const Lambdish\Phunctional\{filter_null, reverse, first};

$lastNonNullableValue = pipe(filter_null, reverse, first);

$lastNonNullableValue(['first', null, 'other', 'last non nullable', null, null]);

// => "last non nullable"

Here we're using the provided constants, that acts like an alias for the functions full qualified namespace (and therefore, are callable).

Documentation

You can find the functions documentation here.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPfunctionalfunctional-programmingimmutabilitymap

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库