GithubHelp home page GithubHelp logo

michalliu / yii2-php-json-rpc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 3fs/php-json-rpc

0.0 1.0 1.0 963 KB

A simple PHP based JSON-RPC client and server.

License: MIT License

Shell 5.87% PHP 94.13%

yii2-php-json-rpc's Introduction

Tutorials

Guide using with Yii2

PHP JSON-RPC

PHP JSON-RPC is a simple JSON-RPC client and server. It is currently in an alpha state, a stable version is expected soon. Word of warning, API will probably change soon as well :)

Build Status

Installation

Composer

Simply add a dependency on trifs/phpjsonrpc to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json:

{
    "require": {
        "trifs/jsonrpc": "dev-master"
    }
}

For a system-wide installation via Composer, you can run:

composer global require 'trifs/phpjsonrpc=*'

Usage Examples

Client (single request)

$client = new trifs\jsonrpc\Client('http://example.com');
$client->request('method-one')
    ->send();

$client = new trifs\jsonrpc\Client('http://example.com');
$client->notification('method-one')
    ->send();

Client (batch request)

$client = new trifs\jsonrpc\Client('http://example.com');
$client->request('method-one')
    ->request('method-two')
    ->notification('method-three')
    ->send();

Server

$input   = file_get_contents('php://input');
$invoker = function($method, array $params = []) {
    return time();
};

$server = new trifs\jsonrpc\Server($input, $invoker);
$server->run();

Contributing

Contributions are always welcome. You make our lives easier by sending us your contributions through GitHub pull requests.

Due to time constraints, we are not always able to respond as quickly as we would like. Please do not take delays personal and feel free to remind us here if you feel that we forgot to respond.

Using PHP JSON-RPC in a development environment

To set PHP JSON-RPC up locally, make sure to have Vagrant and VirtualBox installed.

git clone git://github.com/3fs/php-json-rpc
cd php-json-rpc
vagrant up

After making the changes, run ./build/qa.sh all, sit back and relax. If there are problems reported, repeat. If not, try harder :)

yii2-php-json-rpc's People

Contributors

davidkuridza avatar michalliu avatar

Watchers

 avatar

Forkers

mmplayer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.