All Projects → kuaikuaikim → Dubbo Php Client

kuaikuaikim / Dubbo Php Client

Licence: apache-2.0
Dubbo的php客户端(the php client for dubbo)

Labels

Projects that are alternatives of or similar to Dubbo Php Client

Pepper Metrics
pepper metrics is a tool, it can helps you collect runtime performance use RED method, and then output as log / timeseries data, by default it use prometheus as datasource, grafana as UI
Stars: ✭ 119 (-20.13%)
Mutual labels:  dubbo
Xc Spring Cloud Alibaba
spring cloud alibaba(2.2.1最新版)+nacos+dubbo+gateWay+sentinel+rocketmq+(pgsql/mysql8.0的json支持)+ignite集成可用于docker分布式框架+分布式自动化任务+mybatis多数据源+seate+ shardingSphere分布式分库事务解决方案
Stars: ✭ 131 (-12.08%)
Mutual labels:  dubbo
Tropical Fish
Pragmatic 风格的 Java EE 后端开发脚手架,开箱即用。基于 SpringBoot,技术选型采用主流的框架(Mybatis-Plus,Redisson,Xxl-job,Swagger)。项目特点:自定义查询语法, 可以自由组装查询条件查询数据,配合代码生成模块,提高研发效率;自定义 service 方法级别的文档生成规则,在业务方法增加必要的注解,可生成方法调用树,快速把握复杂代码业务逻辑。
Stars: ✭ 142 (-4.7%)
Mutual labels:  dubbo
X Admin
致力于快速开发中小型后台管理系统项目模板(更新中......)
Stars: ✭ 123 (-17.45%)
Mutual labels:  dubbo
Nutzwk
WK系列开发框架-V1至V5 Java开源企业级开发框架(单应用/微服务/分布式)
Stars: ✭ 1,629 (+993.29%)
Mutual labels:  dubbo
Nacos Sync
Service Sync component
Stars: ✭ 138 (-7.38%)
Mutual labels:  dubbo
Bytetcc Sample
Stars: ✭ 119 (-20.13%)
Mutual labels:  dubbo
Dubbo Go Hessian2
caucho hessian2 implementation in Go for [apache/dubbo-go](https://github.com/apache/dubbo-go) which is compatible with [dubbo-hessian-lite](https://github.com/apache/dubbo-hessian-lite)
Stars: ✭ 146 (-2.01%)
Mutual labels:  dubbo
Gatling Dubbo
A gatling plugin for running load tests on Apache Dubbo(https://github.com/apache/incubator-dubbo) and other java ecosystem.
Stars: ✭ 131 (-12.08%)
Mutual labels:  dubbo
Api Generator
Api Generator是一款可以自动解析Controller类抽取REST接口信息并自动上传YApi的IDEA插件。YApi好伴侣,从此维护文档再也不是事儿了!
Stars: ✭ 139 (-6.71%)
Mutual labels:  dubbo
Dubbo2.5 Spring4 Mybastis3.2 Springmvc4 Mongodb Redis
dubbo2.5-spring4-mybastis3.2-springmvc4-mongodb-redis整合
Stars: ✭ 123 (-17.45%)
Mutual labels:  dubbo
Spring Boot Quick
🌿 基于springboot的快速学习示例,整合自己遇到的开源框架,如:rabbitmq(延迟队列)、Kafka、jpa、redies、oauth2、swagger、jsp、docker、spring-batch、异常处理、日志输出、多模块开发、多环境打包、缓存cache、爬虫、jwt、GraphQL、dubbo、zookeeper和Async等等📌
Stars: ✭ 1,819 (+1120.81%)
Mutual labels:  dubbo
Skill6 Website Backend
java进阶开发,高级版web项目。基于dubbo实现分布式微服务架构,基于spring boot、spring mvc、mybatis、docker、ELK、redis、vue.js、node.js等技术实现的技术分享交流网站。网站名称:技术流,英文名:skill6。主要功能有:登录注册、单点登录、restful设计、文章及评论、代码及资源下载、主题讨论等。持续更新中...
Stars: ✭ 140 (-6.04%)
Mutual labels:  dubbo
Ssm Demo
🍌Spring+SpringMVC+Mybatis+easyUI实现简单的后台管理系统
Stars: ✭ 1,639 (+1000%)
Mutual labels:  dubbo
Alibabacloud Microservice Demo
An Alibaba Cloud native microservice demo powered by Apache Dubbo and Spring Cloud Alibaba
Stars: ✭ 145 (-2.68%)
Mutual labels:  dubbo
Aeraki
Manage any layer 7 traffic in Istio Service Mesh.
Stars: ✭ 119 (-20.13%)
Mutual labels:  dubbo
E3 Springboot
SpringBoot+Docker重构宜立方商城
Stars: ✭ 139 (-6.71%)
Mutual labels:  dubbo
Meetingfilm
基于微服务架构的在线电影购票平台
Stars: ✭ 149 (+0%)
Mutual labels:  dubbo
Technology Talk
汇总java生态圈常用技术框架、开源中间件,系统架构、数据库、大公司架构案例、常用三方类库、项目管理、线上问题排查、个人成长、思考等知识
Stars: ✭ 12,136 (+8044.97%)
Mutual labels:  dubbo
Raincat
强一致分布式事务框架
Stars: ✭ 1,785 (+1097.99%)
Mutual labels:  dubbo

dubbo-php-client

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

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 which i write before.

Notice:

you must start dubbo and zookeeper,register prividers first.

Installation

If you have not installed zookeeper extension 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)
composer require -vvv "quickj/dubbo-php-client:dev-master"

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是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,是阿里巴巴SOA服务化治理方案的核心框架
这是dubbo的唯一php客户端,目前只支持jsonRPC协议,将来会支持多种协议。你可以查看我之前写的dubbo-jsonRPC-demo例子。

注意:

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

安装

如果你还没安装php的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 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组件模式安装

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中的使用:

单实例方式(配置读取config('dubbo_cli.default')):

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

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

多实例的方式(配置读取config('dubbo_cli.connections.xxx')):

$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);

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].