- Is scaytrase/rpc-common compatible with Laravel 10 and PHP 8.1+?
- No, this package was last meaningfully updated in 2017 and lacks PHP 8.1+ features like typed properties or modern type hints. It may work on PHP 7.4 (last LTS before 8.0) but risks breaking with Laravel’s evolving dependencies. Test thoroughly before adoption.
- Does this package support JSON-RPC 2.0 or only SOAP/XML-RPC?
- The package supports multiple RPC protocols (JSON-RPC 1.0/2.0, SOAP, XML-RPC), but the README doesn’t specify which are fully validated. JSON-RPC 2.0 support may require manual configuration, and SOAP/XML-RPC rely on deprecated PHP extensions (ext-soap, ext-xmlrpc).
- How do I integrate this into Laravel’s service container?
- Manual binding is required since the package lacks Laravel-specific features. Use `$this->app->bind(RpcClient::class, function ($app) { ... })` in a service provider. The decorators (lazy, logging, caching) can wrap the client, but no built-in Laravel integration (e.g., facades or config) exists.
- Can I use this for modern microservices in Laravel?
- Not recommended. Modern Laravel apps favor REST/gRPC over RPC, and this package hasn’t been updated for 6+ years. Alternatives like Guzzle + custom JSON-RPC handlers or `overtrue/laravel-json-rpc` are better aligned with contemporary PHP ecosystems and Laravel’s HTTP stack.
- What’s the best way to test RPC calls with this package?
- The package includes a mock client with queued responses and acceptance filters for predictable testing. However, it lacks Laravel testing tool integration (e.g., Pest or PHPUnit helpers). Use the mock client in unit tests, but expect manual setup for acceptance criteria.
- Does the logging decorator integrate with Laravel’s Monolog?
- No, the logging decorator (added in 1.2.1) is generic and doesn’t integrate with Laravel’s Monolog or logging stack. You’ll need to manually configure it to output logs to Laravel’s default channels or a custom handler.
- Are there security risks using this package in production?
- Yes, the package hasn’t been updated since 2017, meaning unpatched vulnerabilities in dependencies (e.g., ext-soap, ext-xmlrpc) may exist. SOAP/XML-RPC are also deprecated in PHP 8.0+. Avoid production use unless you’ve audited and mitigated all risks.
- How do I handle batch requests with this package?
- The package supports batch-style requests, but the README notes that processing depends on the client implementation and may not be truly batched. Use the `RpcRequest::batch()` method, but verify behavior matches your requirements, especially for performance-critical applications.
- What alternatives exist for RPC in Laravel?
- For JSON-RPC, consider `overtrue/laravel-json-rpc` (modern, Laravel-native) or Guzzle with a custom JSON-RPC handler. For SOAP, use PHP’s built-in `SoapClient` or a dedicated SOAP library like `php-soap`. Avoid this package unless maintaining legacy RPC systems.
- Will this package work with Laravel’s queue system?
- No, the package has no native integration with Laravel Queues. You’d need to manually dispatch RPC calls to queues, handle timeouts, and manage retries—adding significant complexity. For async RPC, consider a modern queue worker with Guzzle or a dedicated RPC client.