定制 pkg6/easy-rpc 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

pkg6/easy-rpc

最新稳定版本:v0.1.0

Composer 安装命令:

composer require pkg6/easy-rpc

包简介

Detailed method of actual RPC method

README 文档

README

composer require pkg6/easy-rpc

initialization

Server

$s = new Server();
$s->addCallback('add', function ($a, $b) {
    return $a + $b;
});
$s->start();

Client

$client = new Client();
$client->withURL("http://127.0.0.1:8000");
$add = $client->add(1,2);

addObjectClass refer to:https://github.com/pkg6/easy-rpc/blob/main/tests/objects.php

Interfaces

Server Interface

interface Server
{
    /**
     * Callback binding:
     * @param $method
     * @param Closure $callback
     * @return $this
     */
    public function addCallback($method, Closure $callback);

    /**
     * Class/Method binding:
     * @param $objectOrClass
     * @return $this
     */
    public function addObjectClass($objectOrClass);

    /**
     * List of users to allow
     * @param array $authentications
     * @return $this
     */
    public function withAuthentications(array $authentications);

    /**
     * IP client restrictions
     * @param array $hosts
     * @return $this
     */
    public function allowHosts(array $hosts);

    /**
     * @return mixed
     */
    public function start();
}

Client Interface

interface Client
{
    /**
     * @param $url
     * @return $this
     */
    public function withURL($url);

    /**
     * @param $timeout
     * @return $this
     */
    public function withTimeout($timeout);

    /**
     * @return $this
     */
    public function withDebug();

    /**
     * @param $username
     * @param $password
     * @return $this
     */
    public function withAuthentication($username, $password);

    /**
     * @param CHandle $handle
     * @return $this
     */
    public function withHandle(CHandle $handle);
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-30