Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
composer.lock
composer.phar
vendor/
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Default
all: deps-install


# DEPENDENCY MANAGEMENT

# Updates dependencies according to lock file
deps-install: composer.phar
./composer.phar --no-interaction install

# Updates dependencies according to json file
deps-update: composer.phar
./composer.phar self-update
./composer.phar --no-interaction update


# TESTS AND REPORTS

# Code standard check
cs-check: composer.lock
./vendor/bin/phpcs --standard=PSR1,PSR12 --encoding=UTF-8 --report=full --colors src


# INITIAL INSTALL

# Ensures composer is installed
composer.phar:
curl -sS https://getcomposer.org/installer | php

# Ensures composer is installed and dependencies loaded
composer.lock: composer.phar
./composer.phar --no-interaction install
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Textalk JSON-RPC 2.0

xJsonRPC-PHP is a JSON-RPC library for PHP featuring a client (TODO) and a server. Currently it follows the 2.0 spec of JSON-RPC, including batch calls

## Server

### Usage

There's currently 3 server implementations: Server, WebServer and StdInServer

* `Server` Base class, accepts a JSON string as argument to handle() that is processed as a JSON-RPC request
* `WebServer` Will attempt to read out php://input to get the JSON-RPC request, handle() should be called (without arguments) to make it start processing
* `StdInServer` Does the same as WebServer except it uses php://stdin (command line, etc.) instead of php://input

### Implementing methods

To implement methods you subclass one of the above servers and add methods.
These methods must be public in order to be allowed for server use.

Example
```php
use \Textalk\JsonRpc\Server;

class ExampleServer extends Server
{
public function echo($echo)
{
return $echo;
}
}

$server = ExampleServer();
$response = $server->handle('{"id": 1, "method": "echo", "jsonrpc": "2.0", "params": ["hello world"]}');
```

## Client

TODO
57 changes: 0 additions & 57 deletions README.rst

This file was deleted.

38 changes: 0 additions & 38 deletions autoload.php

This file was deleted.

Loading