PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

Overview

eazy-jsonrpc

Latest Version Total Downloads

PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

Server

SMD Schema available via /server.php?smd

Public Namespace

  • Inherits your exposed class from BaseJsonRpcServer or create new BaseJsonRpcServer( $instance );
  • $server->Execute();

Multiple Namespaces

  • Create new BaseJsonRpcServer();
  • Call $server->RegisterInstance( $instance, $namespace ) as many times as you need
  • $server->Execute();

Client

  • Generate Client from SMD Schema from generator/ php JsonRpcClientGenerator.php
  • Use it:
$client = 
   
    ::GetInstance(
    
     );

try {  
  $result = $client->Method(); 
} catch (BaseJsonRpcException $e) {
  // work with exception
}

    
   

Client with typed returns by rpcgen

  • Generate Client from SMD Schema with rpcgen and save it to RpcClient.php
  • Use it:
$client = RpcClient::GetInstance(
   
    );

try {  
  $result = $client->Method(); 
} catch (BaseJsonRpcException $e) {
  // work with exception
}

   

Doc

  • cd generator
  • php SmdToSwaggerConverter.php 'http://eazyjsonrpc/tests/example-server.php?smd' eazyjsonrpc ../doc/swagger.json
  • open http://eazyjsonrpc/doc/
Comments
  • Ability to update Client Options on the Guzzle Client

    Ability to update Client Options on the Guzzle Client

    I am connecting to a JSON-RPC service and used the generator to create my Client. This API requires a header for Authorization, but I don't believe I am able to edit the property $ClientOptions or the $client directly on the BaseJsonRpcClient. Both properties are private, so I can not adjust the generated client to pass the additional headers that are needed. Should $ClientOptions be a protected variable instead of private? Perhaps even make the Guzzle Client a protected variable, so settings can be adjusted as needed? Or another way would be to pass an optional parameter to the BaseJsonRpcClient constructor to use as the ClientOptions for the Guzzle Client. My apologizes if I missed an obvious answer to this problem. But I can't see a way to pass custom headers to the Guzzle Client.

    opened by jswinborne 1
  • License

    License

    Is this project Open Source? If you don't add a license, it's not Open Source even if the code is public. By default, everything is copyrighted (all right reserved) even if not explicitly written. That's why there are licenses that circumvent that.

    opened by jcubic 1
  • A lot of updates

    A lot of updates

    • Migrate to guzzle http client
    • Update json rpc client - now it returns result and throw rpc/http errors via exceptions.
    • Update generator to use new json rpc client
    opened by sas1024 0
  • Bug fix content-type header

    Bug fix content-type header

    В некоторых библиотеках требуется корректный Content-type. Из-за этого глюка около часа мучался с настройками сервера. Оказалось, что проблема в коде.

    opened by agentsib 0
  • array_key_exists(): Argument #2 ($array) must be of type array, stdClass given

    array_key_exists(): Argument #2 ($array) must be of type array, stdClass given

    Hi! After upgrading PHP to version 8 I've started getting an error:

    Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, stdClass given in /app/vendor/sergeyfast/eazy-jsonrpc/src/EazyJsonRpc/BaseJsonRpcServer.php on line 244

    https://github.com/sergeyfast/eazy-jsonrpc/blob/ba6072bbcdb98b5f6c6c84cbea3528faafabe027/src/EazyJsonRpc/BaseJsonRpcServer.php#L244

    I was able to make it work just replacing array_key_exists call to the following one:

    !property_exists( $params, $param->getName() )
    

    Thank you 🙌

    opened by 31337Ghost 0
Releases(v3.0.2)
Owner
Sergey Bykov
Sergey Bykov
json-rpc client base on http

laravel JSON-RPC客户端(Http协议) 本项目是基于JSON-RPC的服务端端实现的rpc客户端 server端见:https://sajya.github.io/ 初始化 1.发布 php artisan vendor:publish --provider="Ze\JsonRPCC

null 2 Nov 19, 2021
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC. This project is a work-in-progress. Code and docume

Web3 PHP 665 Dec 23, 2022
Laravel ClickHouse adds CH client integration, generation & execution of ClickHouse database migrations to the Laravel application.

Laravel ClickHouse Introduction Laravel ClickHouse database integration. This package includes generation and execution of the ClickHouse database mig

cybercog 11 Dec 20, 2022
PHP package for the Limg.app website - allowing to upload images via the API of the website.

Limg PHP Client Package. Installation You can install the package via composer: composer require havenstd06/limg-php-client Usage use Havenstd06\Limg\

Thomas 3 Jul 27, 2021
A library written in PHP to interact with Coinbase Pro via API.

A library written in PHP to interact with Coinbase Pro via API.

Blake Hamilton 4 Mar 31, 2022
This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP

This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP

Twilio SendGrid 1.4k Dec 27, 2022
ProcessTranslatePage – A Processwire module to translate all page fields via Fluency

ProcessTranslatePage – A Processwire module to translate all page fields via Fluency ProcessTranslatePage is an extension for the Processwire module F

Robert Weiss 5 Aug 29, 2022
A links dashboard which can be integrated via HTML into various other systems.

quickdash Newest QuickDash version. Combines the API and Client repositories. Requirements PHP version 7.4 - https://www.php.net/ Composer - https://g

Hugo Soares 0 Aug 11, 2022
This library is for integration with Salesforce via REST API.

xsolve-pl/salesforce-client Introduction This library is for integration with Salesforce via REST API. Licence This library is under the MIT license.

Boldare / XSolve Sp. z o.o. 31 Oct 13, 2022
Notifies via Telegram when an aircraft passes over a certain area.

adsbTelegramNotifier Notifies via Telegram when an aircraft passes over a certain area. The script gets the data from an existing readsb or dump1090 i

RundesBalli 6 Dec 18, 2022
The very FIRST ever server sided hack client for the PocketMine-MP API (4.x.x)

PHqx or Phqzing Hacks is a Server Sided Hack "Client" you can use for trolling friends (if you have one) or destroying other people at pvp.

Phqzing 5 Jul 25, 2022
Google-api-php-client - A PHP client library for accessing Google APIs

Google APIs Client Library for PHP Reference Docs https://googleapis.github.io/google-api-php-client/main/ License Apache 2.0 The Google API Client Li

Google APIs 8.4k Dec 30, 2022
OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

Mounir R'Quiba 6 Jun 14, 2023
A Class Library enabling Asterisk ARI functionality for PHP

phpari A Class Library enabling Asterisk ARI functionality for PHP Dependencies These are the minimum requirements to have phpari installed on your se

Nir Simionovich 87 Jan 5, 2023
A PHP class for querying the Twitter API and rendering tweets as an HTML list

TweetPHP A PHP class for querying the Twitter API and rendering tweets as an HTML list. Features Works with Twitter API v1.1 Tweets are cached to avoi

Jonathan Nicol 151 Nov 25, 2022
PHP Telegram Bot based on the official Telegram Bot API with iTelegram Class.

iTelegram PHP Telegram Bot based on the official Telegram Bot API Bots: An introduction for developers Bots are special Telegram accounts designed to

iNeoTeam | آی نئو 5 Nov 9, 2022
Simple Google Tts Api Class

Simple Google Tts Api Class

Ömer Faruk Demirel 2 Dec 2, 2022
🍁 Its a HoiChoi Platforn API It Will get All data in json with Streamable Links

✯ Ho!Cho! API ✯ Its a Hoichoi Platforn API It Will get All data in json with Streamable Links ?? Start This Repositry Befor Copying ?? ?? This is Just

Avishkar Patil 14 Dec 22, 2022
A PHP implementation of the Unleash protocol aka Feature Flags in GitLab

A PHP implementation of the Unleash protocol aka Feature Flags in GitLab. You may also be interested in the Symfony Bundle for this package. This impl

Unleash 38 Dec 25, 2022