Skip to content

Commit 725143b

Browse files
author
Sören Jensen
authored
Merge pull request #2 from Textalk/v2
v2.0
2 parents 6291e91 + 3530ef4 commit 725143b

26 files changed

+714
-670
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
composer.lock
3+
composer.phar
4+
vendor/

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Default
2+
all: deps-install
3+
4+
5+
# DEPENDENCY MANAGEMENT
6+
7+
# Updates dependencies according to lock file
8+
deps-install: composer.phar
9+
./composer.phar --no-interaction install
10+
11+
# Updates dependencies according to json file
12+
deps-update: composer.phar
13+
./composer.phar self-update
14+
./composer.phar --no-interaction update
15+
16+
17+
# TESTS AND REPORTS
18+
19+
# Code standard check
20+
cs-check: composer.lock
21+
./vendor/bin/phpcs --standard=PSR1,PSR12 --encoding=UTF-8 --report=full --colors src
22+
23+
24+
# INITIAL INSTALL
25+
26+
# Ensures composer is installed
27+
composer.phar:
28+
curl -sS https://getcomposer.org/installer | php
29+
30+
# Ensures composer is installed and dependencies loaded
31+
composer.lock: composer.phar
32+
./composer.phar --no-interaction install

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Textalk JSON-RPC 2.0
2+
3+
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
4+
5+
## Server
6+
7+
### Usage
8+
9+
There's currently 3 server implementations: Server, WebServer and StdInServer
10+
11+
* `Server` Base class, accepts a JSON string as argument to handle() that is processed as a JSON-RPC request
12+
* `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
13+
* `StdInServer` Does the same as WebServer except it uses php://stdin (command line, etc.) instead of php://input
14+
15+
### Implementing methods
16+
17+
To implement methods you subclass one of the above servers and add methods.
18+
These methods must be public in order to be allowed for server use.
19+
20+
Example
21+
```php
22+
use \Textalk\JsonRpc\Server;
23+
24+
class ExampleServer extends Server
25+
{
26+
public function echo($echo)
27+
{
28+
return $echo;
29+
}
30+
}
31+
32+
$server = ExampleServer();
33+
$response = $server->handle('{"id": 1, "method": "echo", "jsonrpc": "2.0", "params": ["hello world"]}');
34+
```
35+
36+
## Client
37+
38+
TODO

README.rst

Lines changed: 0 additions & 57 deletions
This file was deleted.

autoload.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)