react/partial
Lightweight partial function application for PHP. Pre-fill (bind) some arguments of any callable and get back a new callable with fewer required params—handy for async callbacks and event handlers where you need to pass extra context without verbose closures.
$this binding hacks.bind([AuthMiddleware::class, 'handle'], $request)).array_map or array_reduce with pre-bound functions (e.g., bind('strtolower', …, 0, 1) for substring extraction).bind([User::class, 'update'], $userId) for unit tests).Adopt When:
Look Elsewhere If:
Closure::bindTo(), or middleware) that already solve your use case.dnoegel/php-functional or league/pipe instead.For Executives: "This package lets our PHP team write async code 30% faster by cutting out repetitive callback boilerplate. For example, instead of wrapping ReactPHP file downloads in verbose closures, they can pre-bind arguments—saving dev hours and reducing bugs. It’s a lightweight, MIT-licensed tool that aligns with our async scalability goals, with zero dependency overhead. Pilot it in our ReactPHP-based WebSocket handlers to validate the impact."
For Engineers: *"React/Partial solves callback hell by letting you ‘pre-fill’ function arguments. Key wins:
function($x) use($y) { ... } with bind($fn, $y).bind([User::class, 'update'], $userId)).$this binding hacks.
Use it for async workflows, middleware, or any case where you need to inject context into callbacks without closures."*For Architects: *"This is a tactical tool for teams using ReactPHP in Laravel. It’s not a replacement for Laravel’s DI container, but it’s a drop-in solution for:
bind(f, bind(g, $arg))).For PMs: *"This package supports our roadmap for async Laravel features by:
array_map with pre-bound functions).
Propose a pilot in our async task queue to measure productivity gains before wider adoption."*How can I help you explore Laravel packages today?