PHPackages                             open-solid/callable-invoker - 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. open-solid/callable-invoker

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

open-solid/callable-invoker
===========================

Smart callable execution for PHP

v0.2.1(2mo ago)41.3k—8.5%MITPHPPHP &gt;=8.4CI passing

Since Feb 17Pushed 2mo agoCompare

[ Source](https://github.com/open-solid/callable-invoker)[ Packagist](https://packagist.org/packages/open-solid/callable-invoker)[ RSS](/packages/open-solid-callable-invoker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (5)Used By (0)

CallableInvoker
===============

[](#callableinvoker)

A lightweight PHP callable invoker with smart parameter resolution and execution decoration.

[![Screenshot 2026-02-24 at 10 49 51](https://private-user-images.githubusercontent.com/2028198/554117796-c882ab90-cced-4800-a6b1-ac6d1454ab05.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUzNDc1MjcsIm5iZiI6MTc3NTM0NzIyNywicGF0aCI6Ii8yMDI4MTk4LzU1NDExNzc5Ni1jODgyYWI5MC1jY2VkLTQ4MDAtYTZiMS1hYzZkMTQ1NGFiMDUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDVUMDAwMDI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTA2NjI4NjkwZWYzYWRiM2RmYWUxZjg4YTdlNTJmNmM4OGQ5NjE2N2FhMWY2ZGFiODk0ZmJkMjY0MWRmMTliZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.NTfYXE4B9O7idXBsV96pOz9-Vxh72jo0bvqqsLrsD6s)](https://private-user-images.githubusercontent.com/2028198/554117796-c882ab90-cced-4800-a6b1-ac6d1454ab05.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUzNDc1MjcsIm5iZiI6MTc3NTM0NzIyNywicGF0aCI6Ii8yMDI4MTk4LzU1NDExNzc5Ni1jODgyYWI5MC1jY2VkLTQ4MDAtYTZiMS1hYzZkMTQ1NGFiMDUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDVUMDAwMDI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTA2NjI4NjkwZWYzYWRiM2RmYWUxZjg4YTdlNTJmNmM4OGQ5NjE2N2FhMWY2ZGFiODk0ZmJkMjY0MWRmMTliZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.NTfYXE4B9O7idXBsV96pOz9-Vxh72jo0bvqqsLrsD6s)Overview
--------

[](#overview)

Frameworks often need to execute user-defined callables — controllers, message handlers, console commands, event listeners, or custom entry points — where the arguments are not known at compile time. Each of these requires the same boilerplate: inspect the callable's parameters, resolve their values from some runtime context, and optionally wrap the execution with cross-cutting behavior.

CallableInvoker extracts this pattern into a single reusable component. Instead of duplicating parameter resolution and decoration logic across your framework or application, you delegate it to the invoker and focus on what each callable actually does.

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

[](#installation)

```
$ composer require open-solid/callable-invoker
```

Usage
-----

[](#usage)

The callable invoker accepts any PHP callable — closures, invokable objects, static methods, etc. — and handles the full execution lifecycle:

1. **Resolve** parameters automatically from a context array, default values, or nullability
2. **Decorate** the callable with optional layers (logging, validation, caching, etc.)
3. **Execute** with the resolved arguments and return the result

```
use OpenSolid\CallableInvoker\CallableInvoker;

class HelloHandler
{
    public function __invoke(string $name, int $age = 30): string
    {
        return "Hello, $name! You are $age years old.";
    }
}

$handler = new HelloHandler();
$invoker = new CallableInvoker();
$result = $invoker->invoke(callable: $handler, context: ['name' => 'Alice']);

echo $result; // Output: Hello, Alice! You are 30 years old.
```

Documentation
-------------

[](#documentation)

- [Automatic Parameter Resolution](docs/parameter-resolution.md): Resolves callable parameters from a provided context array, default values, and nullability.
- [Execution Decoration](docs/decoration.md): Wraps callables with nested decorators for cross-cutting concerns like logging, validation, caching, or timing. Each decorator can intercept, modify, or short-circuit the execution.
- [Grouping](docs/grouping.md): Organizes decorators and resolvers into named groups, allowing different callables to use different sets of decorators and resolvers. Multiple groups can be combined in a single invocation.
- [Priority Ordering](docs/priority.md): Controls the execution order of decorators and resolvers via priority values, ensuring predictable behavior when multiple are registered.
- [Support for Any Callable](docs/callables.md): Works with closures, invokable objects, static methods, named functions, and more.
- [Extensibility](docs/extensibility.md): Register custom parameter value resolvers (`ParameterValueResolverInterface`) and decorators (`CallableDecoratorInterface`) to extend the invoker's behavior.
- [Symfony Integration](docs/symfony-integration.md): Ships as a Symfony bundle with autoconfiguration via interfaces and PHP attributes (`#[AsCallableDecorator]`, `#[AsParameterValueResolver]`), service tagging, and compiler passes.
- [Error Handling](docs/error-handling.md): Provides specific exceptions for untyped parameters, variadic parameters, unsupported callables, and unresolvable parameters.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance88

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~10 days

Total

4

Last Release

60d ago

### Community

Maintainers

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

---

Top Contributors

[![yceruto](https://avatars.githubusercontent.com/u/2028198?v=4)](https://github.com/yceruto "yceruto (65 commits)")

---

Tags

callabledecoratorinvokerresolver

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/open-solid-callable-invoker/health.svg)

```
[![Health](https://phpackages.com/badges/open-solid-callable-invoker/health.svg)](https://phpackages.com/packages/open-solid-callable-invoker)
```

###  Alternatives

[winzou/state-machine-bundle

Bundle for the very lightweight yet powerful PHP state machine

34010.4M15](/packages/winzou-state-machine-bundle)[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[sylius/taxonomy-bundle

Flexible categorization system for Symfony.

26388.2k7](/packages/sylius-taxonomy-bundle)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[sylius/addressing-bundle

Addressing and zone management for Symfony applications.

33221.4k3](/packages/sylius-addressing-bundle)[sylius/inventory-bundle

Flexible inventory management for Symfony applications.

19176.7k4](/packages/sylius-inventory-bundle)

PHPackages © 2026

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