• Stars
    star
    179
  • Rank 213,342 (Top 5 %)
  • Language
    PHP
  • License
    GNU Lesser Genera...
  • Created over 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fully unit-tested JSON-RPC 2.0 for PHP

JSON-RPC for PHP

Overview

This package allows you to create and evaluate JSON-RPC messages, using your own PHP code to evaluate the requests.

This package allows you to create and evaluate any JSON-RPC message. It implements the JSON-RPC specifications, but does not provide a transport layerโ€”which you'll also need if you want to send or receive messages over a distance! One of the beautiful features of JSON-RPC is that you can use any transport layer to carry your messages: This package gives you that option.

If you're looking for an end-to-end solution, with the transport layer included, then you should use one of these alternative packages instead:

Features

  • Correct: fully compliant with the JSON-RPC 2.0 specifications (100% unit-test coverage)
  • Flexible: you can use your own code to evaluate the JSON-RPC method strings
  • Minimalistic: extremely lightweight
  • Ready to use, with working examples

Examples

Client

$client = new Client();

$client->query(1, 'add', array(1, 2));

$message = $client->encode();

// message: {"jsonrpc":"2.0","method":"add","params":[1,2],"id":1}

Server

$api = new Api();

$server = new Server($api);

$reply = $server->reply($message);

// reply: {"jsonrpc":"2.0","result":3,"id":1}

See the examples folder for full working examples.

Requirements

  • PHP >= 7.0

License

This package is released under an open-source license: LGPL-3.0

Installation

If you're using Composer, you can include this library (datto/json-rpc) like this:

composer require "datto/json-rpc"

Getting started

  1. Try the examples. You can run the examples from the project directory like this:

    php examples/client.php
    php examples/server.php
    
  2. Take a look at the code "examples/src"โ€”then replace it with your own!

Unit tests

You can run the suite of unit tests from the project directory like this:

./vendor/bin/phpunit

Changelog

See what has changed: Changelog

Author

Spencer Mortensen

More Repositories

1

dattobd

kernel module for taking block-level snapshots and incremental backups of Linux block devices
C
561
star
2

php-json-rpc-http

HTTP client and server for JSON-RPC 2.0
PHP
59
star
3

RDPMux

RDP server multiplexer designed to work with virtual machines
C++
23
star
4

fireeye-red-team-countermeasure-scanner

A scanner to detect the use of stolen FireEye red team tools
YARA
20
star
5

log4shell-tool

Log4Shell Enumeration, Mitigation and Attack Detection Tool
15
star
6

threat-management

This is where the Datto Threat Management team shares threat profiles, signatures, and information on threats that target the MSP community.
10
star
7

throughputd

network traffic monitoring tool
C
9
star
8

zfs2ceph

Convert ZFS send streams to Ceph import streams
C
9
star
9

rhel-reposync-playbook

Ansible playbook to configure RHEL mirrors
Smarty
8
star
10

mysql-failover

Config files for all components used in our lossless MySQL replication and automated failover setup
Smarty
8
star
11

php-json-rpc-ssh

SSH client and server for JSON-RPC 2.0
PHP
7
star
12

tls-config

Our best shot at doing it all with SSL
6
star
13

git-river

Tools for working with upstream repositories
Python
5
star
14

libvirt

Mirror of upstream libvirt repo with additional Datto branches
C
5
star
15

copyondemand

user space block driver that provides a bootable disk image over NFS using NBD
Go
5
star
16

php-json-rpc-auth

Authentication & authorization extension for the JSON-RPC library
PHP
4
star
17

phpunit-entropy

A PHPUnit plugin to aid randomized unit testing
PHP
4
star
18

silver-sparrow-detection-and-prevention-tool

Datto Silver Sparrow Detection and Prevention Tool
Shell
4
star
19

dns-cert-checker

A tool to check and evaluate all TLS certificates served by hosts under a user-provided list of DNS zones.
Python
4
star
20

sisyphus

Kafka -> Influx 2.x forwarder in Go
Go
4
star
21

kmod-dblock

kernel module to implement the backing data source for a block device in userspace
C
4
star
22

php-json-rpc-simple

Request-to-class mapping extension for the JSON-RPC library
PHP
4
star
23

zfs-tests

An attempt at making a broadly applicable zfs test suite
Python
3
star
24

eol-tracker

Web service for monitoring distro package and dependency versions
C++
3
star
25

php-json-rpc-validator

Validation extension for the JSON-RPC library
PHP
3
star
26

php-parser

Define and parse a context-free grammar
PHP
3
star
27

librdpmux

Library to provide low-level QEMU guest interaction capabilties outside the hypervisor. DEAD and part of rdpmux now.
C
3
star
28

es-disk-rebalance

Python
3
star
29

parameter-auto-env

PHP
2
star
30

cass_schema

A gem for managing multiple Cassandra schemas across multiple clusters.
Ruby
2
star
31

product

Product
HTML
1
star
32

zabbix-aggregate-reports

Simple tool that will aggregate data returned from Zabbix
Python
1
star
33

cassava

An un-opinionated Cassandra client built on top of the Datastax Cassandra Driver.
Ruby
1
star
34

datto.github.io

Datto's GitHub Pages site
1
star
35

hdfs-rs

Rust bindings to libhdfs
Rust
1
star
36

php-container-stack

UNMAINTAINED: Reference of Dockerfile for a base container stack for PHP apps
Dockerfile
1
star
37

pyper

Flexible pipelines for data storage and retrieval.
Ruby
1
star
38

php-json-rpc-log

Logged server extension for the JSON-RPC library
PHP
1
star
39

rebalance-core

Module implementing a simple resource rebalancing algorithm
Python
1
star