fguillot/json-rpc
A lightweight PHP implementation of JSON-RPC 2.0 for building clients and servers. It supports method calls, notifications, batch requests, and error handling, with a clean API for exposing PHP classes as remote services. Good for creating APIs or integrating with JSON-RPC services.
null result. Those are exactly the failure modes that generate "why is the integration returning nulls?" support tickets. That is a real reduction in the total cost of ownership we are signing up for.withAuthenticationHeader() reading a forwarded Basic <base64> scheme — mean the dispatcher now fits ordinary handler shapes instead of only toy ones. Still compare against GraphQL (better for flexible client-driven queries) and REST (better for public, cacheable, documented APIs).["5", "3"] to function (int $a, int $b) now receives -32602 Invalid params. If we expose an RPC surface to lenient clients, this is a product compatibility decision, not just an upgrade chore: either commit to a strict, versioned contract (cleanest, and what we should prefer), stay on 1.x for that surface, or put a coercion adapter in our own handler layer where we can change our mind later.2.x branch via an open PR (#29), and the release itself states the API may still move before 2.0.0. So the real decision is not "adopt 2.0" but "adopt a pinned beta for internal and non-critical paths now, or hold on 1.x until 2.0.0 final." Do not put a beta on a path where an API move costs us a customer-facing release. Keep the upgrade guide (UPGRADE-2.0.md) in the migration ticket, not just the composer bump.Consider it when:
Look elsewhere when:
Due-diligence flags — what this release closed and what it did not:
UPGRADE-2.0.md now maps every v1 call to its v2 form and lists behavior changes in full, not just the parameter-coercion change).fguillot/json-rpc) is the one we intend relative to the source repository (matasarei/json-rpc) — a mismatched vendor/name pair is a supply-chain question worth one message, not an incident. Confirm the actual minimum PHP version against our runtime, since CI only proves the newest two. Confirm the license file still asserts MIT. Pin the exact beta and the lockfile; assume we may need to fork, and budget slightly more than a half-day now that the client transports, server, and cookie handling have grown.UPGRADE-2.0.md in full before bumping. The parameter-coercion change is the one most likely to break an existing deployment, and it breaks silently in the sense that it presents as -32602 in production rather than as a composer error.For executives (30 seconds): We need to integrate with partners and internal systems that speak JSON-RPC, a standard remote-call protocol. Rather than have an engineer write and maintain that protocol handling from scratch, this MIT-licensed library gives it to us for free. The newest release closed the quality question — it enforces full test coverage and strict static analysis in CI and tests its network code against real servers — which is what we would otherwise pay for. The remaining risk is not code quality, it is adoption: it is a small project with one maintainer, so we pin the version, wrap it so our code never depends on it directly, and keep the option to fork, which stays cheap at this size. One caveat worth stating plainly: the current release is a beta, so we would use it for internal work first and only adopt it broadly once 2.0 is final. Low cost, low lock-in, no bespoke protocol code.
For engineering: Adopt as the transport layer only. Wrap it in a Laravel service provider with config-driven endpoint registration and a handler registry so controllers and jobs never touch the library directly. Use Laravel's HTTP client where you need middleware, retries, or logging, and let this library handle envelope construction, error mapping, and the now-substantial transport hardening (gzip, short bodies, preserved error objects, response-id validation). Two things to settle before writing code: (1) pin the beta explicitly and treat 2.x as movable — isolate anything that depends on its API behind our facade; (2) decide our parameter-typing posture up front, because v2 no longer coerces, and a lenient client sending ["5","3"] into an int signature now gets -32602. Prefer strict, versioned contracts; if we cannot, either stay on 1.x for that surface or absorb coercion in our own handler layer. Write contract tests against the specific peers we care about, especially batch aggregation, error codes, and the new strict-params behavior — the library's tests validate the library, not our partners. Budget: ~1–3 days of glue plus a spike to validate one real endpoint end-to-end, plus a half-day to work through UPGRADE-2.0.md if we are already on v1. Success criteria: one production integration shipped in under a week with no bespoke protocol code in the codebase, and no beta-versioned library code reachable outside our wrapper. Revisit at 2.0.0 final and again in six months; if we have built the same glue twice, promote it to an internal package.
How can I help you explore Laravel packages today?