Created
June 14, 2014 02:50
-
-
Save jasonjohnson/5cab9571c445084048a2 to your computer and use it in GitHub Desktop.
ZF2 JSON-RPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
curl \ | |
-X POST \ | |
-d '{"method": "add", "params": [1, 2], "id": 1}' \ | |
http://127.0.0.1:8080/server.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"zendframework/zend-json": "2.3.0", | |
"zendframework/zend-server": "2.3.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
class Example | |
{ | |
function add($a, $b) | |
{ | |
return $a + $b; | |
} | |
} | |
$server = new Zend\Json\Server\Server(); | |
$server->setClass('Example'); | |
$server->handle(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
php composer.phar install | |
php -S 0.0.0.0:8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment