PHPackages                             quickj/dubbo-php-client - 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. quickj/dubbo-php-client

ActiveLibrary

quickj/dubbo-php-client
=======================

dubbo php client

1.0\_rc(8y ago)14745051[5 issues](https://github.com/kuaikuaikim/dubbo-php-client/issues)PHPPHP &gt;=5.5.9CI failing

Since Jan 20Pushed 7y ago19 watchersCompare

[ Source](https://github.com/kuaikuaikim/dubbo-php-client)[ Packagist](https://packagist.org/packages/quickj/dubbo-php-client)[ RSS](/packages/quickj-dubbo-php-client/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (2)Versions (8)Used By (0)

dubbo-php-client
================

[](#dubbo-php-client)

the dubbo php client(中文说明往下拉)

[Dubbo](https://github.com/alibaba/dubbo) is a distributed service framework empowers applications with service import/export capability with high performance RPC.

This is only dubbo php clinet implementation. It's only support jsonRPC now.
you can see the example for the [dubbo-jsonRPC-demo](https://github.com/quickj/dubbo_jsonrpc_demo) which i write before.

##### Notice:

[](#notice)

you must start dubbo and zookeeper,register prividers first.

### Installation

[](#installation)

If you have not installed [zookeeper extension](http://pecl.php.net/package/zookeeper) for php,then

```
sudo apt-get install php-pear php5-dev make
sudo pecl install zookeeper
```

Maybe occuring an error with "zookeeper support requires libzookeeper" when you install the zookeeper extension,you should install the libzookeeper needed.

```
cd ${your zookeeper home dir}/src/c/
./configure
make
sudo make install
```

Add zookeeper.so to your php.ini(/etc/php5/apache2/php.ini and /etc/php5/cli/php.ini)

```
extension="/usr/lib/php5/20121212/zookeeper.so"
```

##### Require dubbo-php-client package to your project(composer)

[](#require-dubbo-php-client-package-to-your-projectcomposer)

```
composer require -vvv "quickj/dubbo-php-client:dev-master"
```

### Usage

[](#usage)

```
use DubboPhp\Client\Client;

$options = [
    'registry_address' => '127.0.0.1:2181',
    'version' => '1.0.0',
    'group' =>null,
    'protocol' => 'jsonrpc'
];

try {
    $dubboCli = new Client($options);
    $testService = $dubboCli->getService("com.dubbo.demo.HelloService");
    $ret = $testService->hello("dubbo php client");
    var_dump($ret);
    $mapRet = $testService->mapEcho();
    var_dump($mapRet);

    $objectRet = $testService->objectEcho();
    var_dump($objectRet);

    /**
     * getService method support 2 way. If the forceVgp = true, It will assign the function parameter to service version,group and protocol. Default way is assign the $options configs to these.
     * getService支持两种方式调用。如果forceVgp=true, 该方法将使用传参来绑定服务的版本号，组和协议。默认方式是使用$options数组里的配置绑定。
     */
    $testServiceWithvgp = $dubboCli->getService("com.dubbo.demo.HelloService","1.0.0",null, $forceVgp = true);
    $vgpRet = $testServiceWithvgp->hello("this request from vgp");
    var_dump($vgpRet);
} catch (\DubboPhp\Client\DubboPhpException $e) {
    print($e->getMessage());
}
```

dubbo-php-client 中文说明
=====================

[](#dubbo-php-client-中文说明)

[DUBBO](https://github.com/alibaba/dubbo)是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,是阿里巴巴SOA服务化治理方案的核心框架
这是dubbo的唯一php客户端，目前只支持jsonRPC协议，将来会支持多种协议。你可以查看我之前写的[dubbo-jsonRPC-demo](https://github.com/quickj/dubbo_jsonrpc_demo)例子。

##### 注意:

[](#注意)

使用之前你必须安装和启动dubbo,zookeeper,注册服务者。

### 安装

[](#安装)

如果你还没安装php的[zookeeper扩展](http://pecl.php.net/package/zookeeper)，需要

```
sudo apt-get install php-pear php5-dev make
sudo pecl install zookeeper
```

有可能安装过程中会报错"zookeeper support requires libzookeeper",说明缺少libzookeeper库，你首先需要安装该库。

```
cd ${your zookeeper home dir}/src/c/
./configure
make
sudo make install
```

添加 zookeeper.so 到你的php.ini(/etc/php5/apache2/php.ini和/etc/php5/cli/php.ini)
添加以下这行

```
extension="/usr/lib/php5/20121212/zookeeper.so"
```

按Composer规范使用dubbo-php-client
=============================

[](#按composer规范使用dubbo-php-client)

```
composer require -vvv "quickj/dubbo-php-client:dev-master"
```

### 调用样例-直接类调用：

[](#调用样例-直接类调用)

```
use DubboPhp\Client\Client;

$options = [
    'registry_address' => '127.0.0.1:2181',
    'version' => '1.0.0',
    'group' =>null,
    'protocol' => 'jsonrpc'
];

try {
    $dubboCli = new Client($options);
    $testService = $dubboCli->getService("com.dubbo.demo.HelloService");
    $ret = $testService->hello("dubbo php client");
    var_dump($ret);
    $mapRet = $testService->mapEcho();
    var_dump($mapRet);

    $objectRet = $testService->objectEcho();
    var_dump($objectRet);

    /**
     * getService method support 2 way. If the forceVgp = true, It will assign the function parameter to service version,group and protocol. Default way is assign the $options configs to these.
     * getService支持两种方式调用。如果forceVgp=true, 该方法将使用传参来绑定服务的版本号，组和协议。默认方式是使用$options数组里的配置绑定。
     */
    $testServiceWithvgp = $dubboCli->getService("com.dubbo.demo.HelloService","1.0.0",null, $forceVgp = true);
    $vgpRet = $testServiceWithvgp->hello("this request from vgp");
    var_dump($vgpRet);
} catch (\DubboPhp\Client\DubboPhpException $e) {
    print($e->getMessage());
}
```

### Laravel组件模式安装

[](#laravel组件模式安装)

config/app.php的

providers数组中增加：

```
DubboPhp\Client\DubboPhpClientServiceProvider::class
```

aliases别名数组中增加：

```
'DubboPhpClient'=>DubboPhp\Client\Facades\DubboPhpClient::class,

'DubboPhpClientFactory'=>DubboPhp\Client\Facades\DubboPhpClientFactory::class,
```

然后命令行发布一下系统基本配置文件dubbo\_cli.php到config路径：

```
php artisan vendor:publish --provider="DubboPhp\Client\DubboPhpClientServiceProvider"
```

基本安装配置完成，相关的配置在config('dubbo\_cli.default')中设置，具体参考配置文件

### Laravel中的使用：

[](#laravel中的使用)

#### 单实例方式（配置读取config('dubbo\_cli.default')）：

[](#单实例方式配置读取configdubbo_clidefault)

```
$testService = DubboPhpClient::getService('com.dubbo.demo.HelloService');

$ret = $testService->hello("dubbo php client");
var_dump($ret);

```

#### 多实例的方式（配置读取config('dubbo\_cli.connections.xxx')）：

[](#多实例的方式配置读取configdubbo_cliconnectionsxxx)

```
$clientA = DubboPhpClientFactory::factory(config('dubbo_cli.connections.xxxA'));
$testServiceA = $clientA->getService('com.dubbo.demo.HelloService');
$retA = $testServiceA->hello("dubbo php client");
var_dump($retA);

$clientB = DubboPhpClientFactory::factory(config('dubbo_cli.connections.xxxB'));
$testServiceB = $clientB->getService('com.dubbo.demo.HelloService');
$retB = $testServiceB->hello("dubbo php client");
var_dump($retB);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.1% 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 ~143 days

Recently: every ~101 days

Total

6

Last Release

3051d ago

Major Versions

0.4.0 → 1.0\_rc2018-01-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4029510d9d14d28492be914c7cc69a78598fc6c93a82c9acfbbb4e3c15cfc7a?d=identicon)[quickj](/maintainers/quickj)

---

Top Contributors

[![kuaikuaikim](https://avatars.githubusercontent.com/u/5283329?v=4)](https://github.com/kuaikuaikim "kuaikuaikim (64 commits)")[![nickfan](https://avatars.githubusercontent.com/u/100613?v=4)](https://github.com/nickfan "nickfan (14 commits)")[![coolswater](https://avatars.githubusercontent.com/u/10937045?v=4)](https://github.com/coolswater "coolswater (3 commits)")[![mitolH](https://avatars.githubusercontent.com/u/9016864?v=4)](https://github.com/mitolH "mitolH (2 commits)")

---

Tags

dubbodubbo-laraveldubbo-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/quickj-dubbo-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/quickj-dubbo-php-client/health.svg)](https://phpackages.com/packages/quickj-dubbo-php-client)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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