PHPackages                             farafiri/easy-callback - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. farafiri/easy-callback

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

farafiri/easy-callback
======================

Utility for creating simple callback functions for filter and map functions in readable way

06PHP

Since Oct 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/farafiri/easy-callback)[ Packagist](https://packagist.org/packages/farafiri/easy-callback)[ RSS](/packages/farafiri-easy-callback/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

easy-callback
=============

[](#easy-callback)

Library for providing short and easy way for creating callback.

Functional programing is very powerful concept and I like to use this paradigm in my work. However current php closure syntax is quite verbose. Check following example:

```
/** filter books written by $author */
$books = array_filter($allBooks, function($book) use ($author) {
    return $book->getAuthor() === $author;
});
```

vs:

```
use EasyCallback\f;

/** filter books written by $author */
$books = array_filter($allBooks, f()->getAuthor()->ecEq($author));
```

Doc / Examples
==============

[](#doc--examples)

Library always works on instances of EasyCallback\\Wrapper class (all functions in this library returns instance of EasyCallback\\Wrapper).

```
use EasyCallback\f;

f(); //Callable returning first parameter. Equivalent to:
function ($p1) {return $p1;};
f(2); //Callable returning 2-nd parameter. Equivalent to:
function ($p1, $p2) {return $p2;};
f($value, true); //Callable returning $value. Equivalent to
function () use ($value) {return $value;};

//EasyCallback\Wrapper support array syntax:
$f['a']; // Equivalent to:
function(...$params) use ($f) {return $f(...$params)['a'];}

f()['a']; //Equivalent to:
function($p1) {return $p1['a'];};
f(2)['a']; //Equivalent to:
function($p1, $p2) {return $p2['a'];};
f()['a']['b']; //Equivalent to:
function($p1) {return $p1['a']['b'];};
f($value, true)['a']; //Equivalent to:
function() use ($value) {return $value['a'];};
f($value, true)[f()]; //Equivalent to:
function($p1) use ($value) {return $value[$p1];};

//Similarly get property syntax and method call syntax is supported:
f()->exampleProperty; //Equivalent to:
function($p1) {return $p1->exampleProperty;};
f()->exampleMethod(1); //Equivalent to:
function($p1) {return $p1->exampleMethod(1);};
f()->exampleMethod1()->exampleMethod2(); //Equivalent to:
function($p1) {return $p1->exampleMethod1()->exampleMethod2();};
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec7b6fe75e8ba3d550f2dc80526a74a90afad386140ecaa3fa9a808e5b5d83c2?d=identicon)[farafiri](/maintainers/farafiri)

---

Top Contributors

[![farafiri](https://avatars.githubusercontent.com/u/6407542?v=4)](https://github.com/farafiri "farafiri (24 commits)")

### Embed Badge

![Health badge](/badges/farafiri-easy-callback/health.svg)

```
[![Health](https://phpackages.com/badges/farafiri-easy-callback/health.svg)](https://phpackages.com/packages/farafiri-easy-callback)
```

###  Alternatives

[wallacemartinss/filament-icon-picker

A beautiful icon picker component for Filament v5 using blade-ui-kit/blade-icons

4716.9k29](/packages/wallacemartinss-filament-icon-picker)[eminos/statamic-tabs

A Statamic addon to be able to group fields into tabs.

1567.9k](/packages/eminos-statamic-tabs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
