- How do I install fguillot/json-rpc in a Laravel application?
- Install it with Composer using composer require fguillot/json-rpc. The package is a plain PHP library with no Laravel service provider, so you need to bind it into the container yourself. A common approach is a small service provider that registers a client adapter behind a JsonRpcClientInterface. Wrap request building and response parsing inside that adapter so controllers and jobs do not depend on the package directly.
- Does fguillot/json-rpc support batch requests and notifications?
- Yes. The library supports JSON-RPC 2.0 batch requests, notifications, named parameters, and middleware. Notifications are fire-and-forget calls that expect no response, which is useful for command channels and webhook-style flows. Because adoption is low, verify the exact behavior against your target endpoint with contract tests before relying on edge cases.
- Is there a Laravel package or service provider for fguillot/json-rpc?
- No. fguillot/json-rpc is a framework-agnostic JSON-RPC client and server utility, not a Laravel-native integration. You own the glue code: container bindings, configuration and environment handling, typed request and response wrappers, error mapping, logging, and HTTP transport policy. Keep those concerns in an application-owned adapter rather than scattering package calls through the codebase.
- How do I call a remote JSON-RPC endpoint from Laravel using fguillot/json-rpc?
- Create a client instance, point it at your endpoint URL, and send method calls through it. In Laravel, externalize the endpoint, timeouts, retry policy, auth headers, TLS settings, and JSON-RPC version via config and environment variables. Keep protocol-specific request construction, batch handling, error codes, and response parsing inside a JsonRpcClientInterface adapter so controllers and jobs stay transport-agnostic. Add logging and failure mapping around that adapter.
- Can I expose a Laravel class as a JSON-RPC server with fguillot/json-rpc?
- Yes, the library includes a server component that can map JSON-RPC methods to PHP callables or class methods. However, exposing it publicly means you must add authentication, authorization, input validation, rate limiting, replay protection, and error-disclosure controls yourself. The library likely does not solve those concerns on its own. Client mode is generally lower risk than server mode for this reason.
- Which PHP and Laravel versions work with fguillot/json-rpc?
- The package is a lightweight PHP library with no Laravel-specific version constraint, so check its composer.json and confirm resolution against your existing dependency graph. Run static analysis and integration tests on the oldest and newest PHP and Laravel combinations you support. Do not assume Laravel compatibility just because Composer installs it successfully.
- How should I test JSON-RPC integrations in Laravel?
- Write contract tests around expected request payloads, batch handling, error codes, and response parsing before wiring the package into domain code. Use a fake or local JSON-RPC server for integration tests so you can assert timeout, retry, and failure-mapping behavior. Keep the tests on the adapter boundary so you can replace the underlying library later without rewriting them.
- Is fguillot/json-rpc safe for a public-facing production API?
- Be cautious. The library is MIT-licensed, but adoption is very low at roughly 23 stars and zero dependents, which raises the risk of undocumented edge cases and slow security response. It is a poor default for public APIs and fits better as an isolated adapter for internal service-to-service calls, legacy RPC endpoints, or control-plane APIs. Require a proof of concept, contract tests, and an exit path before committing to production.
- How do I handle timeouts, retries, and errors with fguillot/json-rpc?
- The library handles JSON-RPC protocol concerns, but transport policy such as timeouts, retries, auth headers, and TLS settings must be configured around it. Map JSON-RPC error codes to your application's exception types inside the adapter. Add observability for timeouts and upstream failures, and define an on-call owner for integration issues.
- What are alternatives to fguillot/json-rpc, and what if upstream stalls?
- A native Laravel HTTP client implementation is a viable fallback for simple JSON-RPC calls, and other JSON-RPC libraries exist if you need broader feature coverage. Because upstream activity and community support are likely limited, budget for dependency pinning, periodic security review, and possibly maintaining a small fork. Keep all package usage behind an adapter so replacement does not touch domain code. Verify release provenance and tag integrity, since the repository link differs from the package name.