New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

sajya/client

HTTP client and server for JSON-RPC 2.0
1,041,064 21
Install
composer require sajya/client
Latest Version:1.5.0
Laravel:8 – 13
License:MIT
Last Updated:Aug 25, 2026
Links: GitHub  ·  Packagist
Maintainer: tabuna

Introduction

run-tests

This package lets you set up a JSON-RPC client over HTTP(S), using your PHP code to make the requests. Built around Laravel (Doesn't require the entire framework, just its component) expressive HTTP wrapper, it allows you to customize things like authorization, retries, and more.

Install

Go to the project directory and run the command:

$ composer require sajya/client

Usage

use Illuminate\Support\Facades\Http;
use Sajya\Client\Client;

$client = new Client(Http::baseUrl('http://localhost:8000/api/v1/endpoint'));

$response = $client->execute('tennis@ping');

$response->result(); // pong

By default, the request identifier will be generated using the UUID, you can get it by calling the id() method

$response->id();

To get the result of an error, you need to call the error() method

$response->error();

Parameters

Example with positional parameters:

$response = $client->execute('tennis@ping', [3, 5]);

Example with named arguments:

$response = $client->execute('tennis@ping', ['end' => 10, 'start' => 1]);

Batch requests

Call several procedures in a single HTTP request:

$batchData = $client->batch(function (Client $client) {
    $client->execute('tennis@ping');
    $client->execute('tennis@ping');
});

Notify requests

$client->notify('procedure@method');

License

The MIT License (MIT). Please see License File for more information.

Related Packages

sajya/server

Easy implementation of the JSON-RPC 2.0 server for the Laravel framework.

2,121,833 242
ahondor/laravel-rpc-server

Easy implementation of the JSON-RPC 2.0 server for the Laravel framework.

1,854 0
railken/lara-eye
38,915 39
api
juampi92/api-resources

Manage your resources maintaining API versioning

934,433 111
tailflow/laravel-orion

Orion for Laravel allows you to build a fully featured REST API based on your El...

803,682 1,592

Version History

Version Released Laravel License
1.5.0 8.0|^9.0|^10.0|^11.0|^12.0|^13.0 MIT
1.4.1 8.0|^9.0|^10.0|^11.0|^12.0 MIT
1.4.0 8.0|^9.0|^10.0|^11.0|^12.0 MIT
1.3.0 8.0|^9.0|^10.0|^11.0|^12.0 MIT
1.2.0 8.0|^9.0|^10.0|^11.0 MIT