PHPackages                             lobtao/rpc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. lobtao/rpc

ActiveLibrary[API Development](/categories/api)

lobtao/rpc
==========

A simple rpc invoke for php

0.0.2(4y ago)187proprietaryPHP

Since Jan 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/lobtao/rpc)[ Packagist](https://packagist.org/packages/lobtao/rpc)[ RSS](/packages/lobtao-rpc/feed)WikiDiscussions main Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

install
=======

[](#install)

```
composer require lobtao/rpc
```

A simple rpc invoke for php
===========================

[](#a-simple-rpc-invoke-for-php)

```
use lobtao\rpc\BaseRpc;
use lobtao\rpc\RpcException;

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

$rpc = new BaseRpc();

/**
 * 类和方法以_分割
 * 可访问方法    test_func1, test_func2
 * 不存在方法    test_func3
 * 不存在类      test1_func
 * 禁止访问方法   test_func
 */
$func = 'test_func1'; // 测试访问方法
// 数据必须以数组包裹
$args = [
    [
        'name' => "I'm test data",
    ],
];

// 该部分可以放在控制器方法内, 以提供通用调用服务
try {
    $data = $rpc->handle('lobtao\\example\\service\\', $func, $args, function () use ($func) {
        // 白名单函数
        $while_funcs = [
            'test_func1',
            'test_func2',
        ];

        if (in_array($func, $while_funcs)) {
            return true;
        }

        if ($func == 'test_func') {
            throw new RpcException('禁止访问函数');
        }

        return true;
    }, function ($classpath) {
        // 外部创建服务类对象回调方法，hyperf等框架需要使用make函数创建对象实例，达到依赖注入的目的
        // return make($classpath); // hyperf
        return new $classpath();
    });
    var_dump($data);
} catch (Exception $ex) {
    if ($ex instanceof RpcException) {
        // 记录到日志等
        echo $ex->getMessage() . PHP_EOL;
    }
}
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

2

Last Release

1623d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7aa8c9522feaea303b48224611f39be3663c34eef685930fbf4b1480c24fbeda?d=identicon)[lobtao](/maintainers/lobtao)

---

Top Contributors

[![lobtao](https://avatars.githubusercontent.com/u/3361397?v=4)](https://github.com/lobtao "lobtao (33 commits)")

---

Tags

phprpc

### Embed Badge

![Health badge](/badges/lobtao-rpc/health.svg)

```
[![Health](https://phpackages.com/badges/lobtao-rpc/health.svg)](https://phpackages.com/packages/lobtao-rpc)
```

###  Alternatives

[hyperf/jet

Jet is a unification model RPC Client, built-in JSON RPC protocol, available to running in ALL PHP environments, including PHP-FPM and Swoole/Hyperf environments.

6221.0k3](/packages/hyperf-jet)[swoft/rpc-server

swoft rpc server component

10140.5k5](/packages/swoft-rpc-server)[manamine/php-eos-rpc-sdk

PHP SDK for the EOS RPC API

187.5k](/packages/manamine-php-eos-rpc-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
