承接 paulgessinger/jsonrpc 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

paulgessinger/jsonrpc

Composer 安装命令:

composer require paulgessinger/jsonrpc

包简介

Lightweight framework for JsonRpc APIs.

README 文档

README

#JSONRPC for PHP

Build Status

Allows you to write simple and fast JSON RPC APIs by exposing arbitrary objects to HTTP POST requests.

Installation

By all means; use Composer!

  1. Get Composer
  2. Add "paulgessinger/jsonrpc": "dev-master" to your require
  3. Install dependencies with composer install

Getting started

Put something like this in your bootstrap file (e.g. index.php).

use PG\JsonRpc\Server ;

include __DIR__.'/vendor/autoload.php' ;

$server = new Server() ;

$server->expose('Sample', 'PG\JsonRpc\tests\sample\Sample') ;

$server->run() ;

You can then do POST requests on it with a JSON body in the form of

{
	"jsonrpc":"2.0",
	"id":1,
	"method":"Sample.divide",
	"params": [11, 5]
}

(documented in the JSON RPC specification).

while Sample looks like

namespace PG\JsonRpc\tests\sample;
use PG\JsonRpc\Exception\ArgumentException;

class Sample {
    public function divide($a, $b) {
        return $a/$b ;
    }
	
	// ...
}

You will get a reponsse in the form of

{
	"jsonrpc":"2.0",
	"id":1,
	"result":2.2
}

Have fun.

Tests

The lib tries to be fully unit tested. Go take it for a spin, go to the lib's root directory and run phpunit. PHPUnit is also included in the require-devs so you can get it with composer install --dev or composer update.

Contributors

License

The MIT License (MIT)

Copyright (c) 2013 Paul Gessinger

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

统计信息

  • 总下载量: 163
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固