Queue-based request-reply RPC for Switon Framework.
composer require switon/rpcRequirements: PHP 8.3+
use Switon\Core\Attribute\Autowired;
use Switon\Rpc\RpcInterface;
class UserService
{
#[Autowired] protected RpcInterface $rpc;
public function profile(int $userId): array
{
return $this->rpc->call(UserProfileService::class . '::profile', [$userId], 3);
}
}
class UserProfileService
{
public function profile(int $userId): array
{
return ['id' => $userId, 'name' => 'mark'];
}
}Docs: https://docs.switon.dev/latest/rpc
MIT.