- What is tochka-developers/jsonrpc used for in Laravel?
- It exposes Laravel application logic as JSON-RPC 2.0 endpoints, handling RPC routing, request handling, middleware, error responses, and batched calls. It helps build structured APIs without REST boilerplate. It fits service-layer APIs, especially when using attribute-first definitions and OpenRPC integration.
- How do I install tochka-developers/jsonrpc in a Laravel app?
- Install it with Composer using composer require tochka-developers/jsonrpc and wire the package into your Laravel application. For v6, your environment must run Laravel 11+ and PHP 8.3+, because Laravel 10 and PHP 8.2 support were dropped. Pin the current stable version in production until you have tested the v6 beta migration path.
- Which Laravel and PHP versions does v6 of this JSON-RPC package support?
- The v6 major release targets Laravel 11+ and PHP 8.3+. It drops Laravel 10 and PHP 8.2 support, so those platforms must be upgraded first. Older package versions may support earlier Laravel and PHP combinations, but v6 is not a drop-in for legacy runtimes.
- How do I define JSON-RPC methods in v6?
- v6 uses an attribute-first approach, so every exposed API method must use the #[ApiMethod] attribute. Missing attributes can silently hide methods, so inventory and annotate all RPC controllers and methods during migration. Documentation summary and description metadata move to OpenRPC rather than Laravel package config.
- What breaking changes are in v6.0.0-beta.1?
- v6 removes config keys such as summary, description, allowParentMethods, and customCasters. It eliminates JsonRpcController trait usage and requires #[ApiMethod] on every exposed method. Custom casters must be replaced with Laravel casts, DTOs, or explicit mapping, and validation and error contracts may change.
- Does this package support batched JSON-RPC calls and middleware?
- Yes, the package provides batched calls and middleware alongside RPC routing, request handling, and error responses. These features let you build structured JSON-RPC APIs without adding REST boilerplate. Test batch behavior and middleware ordering against your client contracts when upgrading, especially across a major release.
- How should I migrate customCasters and JsonRpcController usage?
- Replace customCasters with Laravel casts, DTOs, or explicit mapping, then validate serialization and deserialization for parameters and responses. Remove deprecated JsonRpcController trait usage and ensure every exposed method has #[ApiMethod]. Run contract tests for request and response payloads and error formats before production rollout.
- What are the risks of adopting the v6 beta in production?
- The beta status adds release instability risk, and beta-to-GA behavior may change. Missing ApiMethod attributes can hide methods, removed config keys or traits can cause startup or fatal errors, and customCasters removal can break casting. The validation redesign may also alter client-visible error contracts, so use a migration branch and rollback plan.
- How do nested object parameters and ApiValidation work?
- v6 adds nested object parameter support and field-level ApiValidation to improve contract expressiveness. This is valuable for DTO-style APIs but increases dependence on correct DTO and serialization behavior. Validate scalar, nested object, and array-of-object parameters, and benchmark deep request graphs on high-traffic RPC endpoints.
- What alternatives or maintenance considerations exist for Laravel JSON-RPC?
- This package is best suited to Laravel 11+ and PHP 8.3+ services already using JSON-RPC or OpenRPC and willing to adopt attribute-driven definitions. Alternatives depend on whether you need OpenRPC generation, batching, middleware, and Laravel integration, so compare those requirements before switching. Major-version maintenance requires clear ownership of OpenRPC metadata, attribute conventions, and client error contracts.