tourze/json-rpc-endpoint-bundle
A Symfony bundle for building JSON-RPC endpoints, wiring request handling and service registration into your application so you can expose PHP services over a JSON-RPC API with minimal configuration.
Install with composer require tourze/json-rpc-endpoint-bundle. Because 2.0.0 is a major release, pin it explicitly ("^2.0") rather than floating, and diff the 1.0.0...2.0.0 changelog before upgrading an existing app.
Look first at composer.json (confirm the PHP/Symfony/Laravel version constraints — this is a Symfony-style bundle, so in Laravel you'll typically register it through a bridge/service provider or a small adapter rather than a native Laravel package auto-discovery flow), then src/ for the endpoint controller, method resolver, and any PHP attributes used to mark exposed methods.
Identify where the JSON-RPC route is registered (route loader, routes/ file, or config/routes*.yaml). In Laravel, mirror that route in routes/api.php pointing at the package's endpoint action so it sits behind your normal middleware stack.
First use case: take one existing application service with a simple scalar-in/scalar-out method, annotate/expose it as a JSON-RPC method, and hit the endpoint with a raw curl POST:
curl -X POST https://app.test/rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"user.get","params":{"id":1},"id":1}'
Getting one method round-tripping end to end tells you more about the 2.0 API surface than reading the source top to bottom.
method field. Put auth, throttling, and request-ID logging in HTTP middleware; put per-method authorization inside the method handler.params into a DTO, run Laravel validation on it, and throw a domain exception the bundle's error handler converts into a JSON-RPC error object. This keeps validation and error codes in one place.-32xxx codes for protocol errors vs. your own -32000..-32099 application range) and centralize the exception-to-code translation. Anything that leaks a stack trace into error.data is a bug.id (notifications must return an empty body, not null) and array payloads (batch) if clients need them; verify 2.0 behavior here specifically, as batch/notification handling is a common breaking-change area in major bumps.result/error, not on HTTP status alone. Keep a small fixture set: success, validation failure, unknown method, unauthorized, notification, batch.jsonrpc: "2.0" and a monotonically increasing id, and throws on error — don't let callers hand-roll payloads.error from the body. Some servers return 200 for protocol errors too — confirm which the bundle does so your monitoring isn't blind.error.code and error.message server-side with the request payload.src/.params. JSON objects vs. positional arrays change how the resolver binds arguments. Be consistent, and document it for clients — mixing the two is a frequent source of "works for me" bugs.composer.lock and review diffs on every bump rather than trusting semver alone.How can I help you explore Laravel packages today?