switon / invoker
Method invocation orchestration for Switon (standalone)
v1.0.0
2026-05-10 03:07 UTC
Requires
- php: >=8.3
- switon/core: ^1.0
- switon/di: ^1.0
- switon/invocation: ^1.0
Requires (Dev)
- switon/binding: ^1.0
- switon/testing: ^1.0
README
Method invocation orchestration for Switon Framework.
Installation
composer require switon/invoker
Requirements: PHP 8.3+
Quick Start
use ReflectionMethod; use Switon\Binding\ArgumentsBinderInterface; use Switon\Core\Attribute\Autowired; use Switon\Invoking\InvokerInterface; class Dispatcher { #[Autowired] protected ArgumentsBinderInterface $argumentsBinder; #[Autowired] protected InvokerInterface $invoker; public function dispatch(object $controller, string $action): mixed { $method = new ReflectionMethod($controller, $action); $arguments = $this->argumentsBinder->resolve($method); return $this->invoker->invoke([$controller, $action], $arguments); } } class PostController { public function showAction(int $id): array { return ['id' => $id]; } }
Docs: https://docs.switon.dev/latest/invoker
This package owns the framework invoker contract:
Switon\Invoking\InvokerInterface
Invocation hooks now live in switon/invocation.
License
MIT.