mszewcz/php-json-rpc

JSON RPC 2.0 client and server implementation for PHP 7.1+

1.0.1 2018-06-21 09:21 UTC

This package is auto-updated.

Last update: 2024-04-16 09:35:37 UTC


README

PHP 7.1+ implementation of JSON RPC 2.0. Client and server libraries can handle regular requests, notifications. Batch requests are supported. Server supports namespaces and self-description (automatically provides input and output schema for each method in each namespace - please refer to Wiki). Client is able to send requests using stream context, cURL extension or by user defined transport class.

Build Status Codacy Badge Codacy Badge

Contents

What is JSON RPC?

JSON RPC is a simple and light weight communication protocol that allows clients and servers talk to each other. Version 2.0, which is implemented by this library, is described here. Please take a while to read this, to understand request and response formats as well as some server-regarded rules.

Installation

If you use Composer to manage the dependencies simply add a dependency on mszewcz/php-json-rpc to your project's composer.json file. Here is a minimal example of a composer.json:

{
    "require": {
        "mszewcz/php-json-rpc": ">=1.0"
    }
}

You can also clone or download this respository.

php-json-rpc meets PSR-4 autoloading standards. If using the Composer please include its autoloader file:

require_once 'vendor/autoload.php';

If you cloned or downloaded this repository, you will have to code your own PSR-4 style autoloader implementation.

Usage

Please refer to project Wiki:

You may also want to check examples directory.

Contributing

Contributions are welcome. Please send your contributions through GitHub pull requests

Pull requests for bug fixes must be based on latest stable release from the master branch whereas pull requests for new features must be based on the developer branch.

Due to time constraints, I am not always able to respond as quickly as I would like. If you feel you're waiting too long for merging your pull request please remind me here.

Coding standards

I follow PSR-2 coding style and PSR-4 autoloading standards. Be sure you're also following them before sending us your pull request.

License

php-json-rpc is licensed under the MIT License - see the LICENSE file for details.