Download the PHP package superconductor/rpc without Composer
On this page you can find all versions of the php package superconductor/rpc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download superconductor/rpc
More information about superconductor/rpc
Files in superconductor/rpc
Package rpc
Short Description A Laravel package for implementing the Remote Procedure Call (RPC) protocol
License MIT
Informations about the package rpc
Superconductor RPC
A Laravel package for implementing the JSON-RPC 2.0 protocol with type safety and Laravel integration.
Requirements
- Laravel 10.0, 11.0, or 12.0
- PHP 8.2 or greater
- Spatie Laravel Data ^4.11
Installation
Install the package via composer:
The package will be auto-discovered by Laravel's package discovery. If you're using an older version of Laravel, add the service provider to your config/app.php
:
Usage
Register Procedures
In your routes/web.php
or any autoloaded routing file:
Create Procedure Classes
Handle JSON-RPC Requests
Advanced Usage
Custom Request DTOs
Create type-safe request objects using Spatie Laravel Data:
Notifications
Handle fire-and-forget operations:
Error Handling
Architecture
Core Components
ProcedureRegistrar
: Manages RPC method registration and executionProcedureRoute
: Handles individual procedure routing and parameter bindingRpcMessage
: Base class for all JSON-RPC messages with serializationRpcProcedure
: Abstract base class for all RPC procedures
Message Types
RpcRequest
: Represents JSON-RPC requests with IDs (expect responses)RpcNotification
: Represents JSON-RPC notifications (fire-and-forget)RpcResult
: Represents successful responsesRpcError
: Represents error responses with proper error codes
Error Codes
The package includes all standard JSON-RPC 2.0 error codes:
Testing
API Reference
RPC Facade
method(string $method, string $action): ProcedureRoute
Register an RPC method with its handler class.
call(RpcRequest $message): RpcResult|RpcError|null
Execute an RPC call and return the response.
notify(RpcNotification $message): bool|RpcError
Send a notification (fire-and-forget operation).
RpcMessage Class
fromJsonRpc(string|array $message): RpcMessage
Parse a JSON-RPC message from string or array format.
toJsonRpc(bool $toString = false): array|string
Serialize the message to JSON-RPC format.
Credits
All versions of rpc with dependencies
ext-json Version *
spatie/laravel-data Version ^4.11
lorisleiva/laravel-actions Version ^2.6
projectsaturnstudios/laravel-design-patterns Version ^0.1.0