Hprose is a cross-language RPC. This project is Hprose 3.0 for PHP

Overview

Hprose

Hprose 3.0 for PHP

Build Status Join the chat at https://gitter.im/hprose/hprose-php Supported PHP versions: =7.1+ Packagist Packagist Download License

Introduction

Hprose is a High Performance Remote Object Service Engine.

It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful. You just need a little time to learn, then you can use it to easily construct cross language cross platform distributed application system.

Hprose supports many programming languages, for example:

  • AAuto Quicker
  • ActionScript
  • ASP
  • C++
  • Dart
  • Delphi/Free Pascal
  • dotNET(C#, Visual Basic...)
  • Golang
  • Java
  • JavaScript
  • Node.js
  • Objective-C
  • Perl
  • PHP
  • Python
  • Ruby
  • ...

Through Hprose, You can conveniently and efficiently intercommunicate between those programming languages.

This project is the implementation of Hprose for PHP.

Issues
  • 我用192.168.1.79的ip搭建了一个server,用192.168.1.4作为client 请求时,返回了这样的结果

    我用192.168.1.79的ip搭建了一个server,用192.168.1.4作为client 请求时,返回了这样的结果

    Exception: Success in /home/share/cc/vendor/hprose/hprose/src/Hprose/Swoole/Socket/Client.php:139

    opened by fucongcong 9
  • 异常处理

    异常处理

    请问下使用的时候,客户端参数传输错误导致服务端异常退出,try cactch 无法捕获异常,onSendError也处理不了,请问下有什么解决方案吗

    require __DIR__.'/../vendor/autoload.php';
    use Hprose\Swoole\Server;
    function a($b, $c) {
        echo $b;
        echo  $c;
    }
    
        $server = new Server("tcp://0.0.0.0:1314");
        $server->setDebugEnabled(true);
        dump($server->isDebugEnabled());
        $server->addFunction('a');
        $server->onSendError = function ($error, \stdClass $context) {
            dump($error->getMessage());
            return true;
        };
        $server->start();
    
    
        $client = \Hprose\Client::create('tcp://127.0.0.1:1314', false);
        return $client->a(['name' => 'xz'],  new InvokeSettings(array('mode' => ResultMode::Normal)));
    
    opened by ccmyli 9
  • support set host

    support set host

    $client = new Client('http://192.168.1.2', false);
    $client->setHeader('Host', 'api.a.com'); // now not support
    $response = $client->someaction();
    
    opened by huangdijia 8
  • 请教一下性能的问题

    请教一下性能的问题

    最近用hprose做服务,测试程序中以前的业务逻辑不变,只是多加了hprose;

    //上面是老逻辑代码
    $hprose = new Client("tcp://0.0.0.0:1314", false);
    $hprose->test();
    

    test()方法有涉及到逻辑处理有一定性能开销的,我想知道这个new [Client()的性能开销大不大的?压测了下感觉原来的代码性能降了很多; 没加hprose: image

    加了hprose: image

    还有问下有什么技术手段,可以让这个new的Client不用频繁的实例化?1000个用户的http请求就是new1000次了,会产生1000个tcp连接,这种并发高了咋办?

    opened by forgottener 8
  • hprose 结合tp5怎么使用

    hprose 结合tp5怎么使用

    hprose 中http服务结合tp5怎么使用,我弄不出来,客户端老是报错(Wrong Response)

    opened by Hongic 8
  • 为什么在fpm下,异步回调输出不显示,cli可以输出

    为什么在fpm下,异步回调输出不显示,cli可以输出

    //tcp服务
    require_once './src/Hprose.php';
    
    use Hprose\Socket\Server;
    
    function hello($name) {
        return "Hello $name!";
    }
    $server = new Server("tcp://127.0.0.1:1314");
    $server->addFunction('hello');
    $server->debug = true;
    $server->start();
    
    //tcp客户端
    $client = new \Hprose\Socket\Client('tcp://127.0.0.1:1314', true);
    $promise = $client->hello("abc");
    
    $promise->then(function($value) {
        var_dump($value);
        \Log::info($value);
    })->catchError(function($reason) {
        var_dump($reason);
        \Log::info($reason);
    });
    
    var_dump('??');
    

    网页输出

    image

    cli输出

    image

    opened by mrzxy 6
  •  fix list or map judge error

    fix list or map judge error

    一次循环解决所有问题

    opened by wklzz 6
  • fix list or map judge error

    fix list or map judge error

    上次的修改范围覆盖有问题,这次彻底修复了。

    opened by wklzz 6
  • 405: Method Not Allowed

    405: Method Not Allowed

    PHP Fatal error: Uncaught Exception: 405: Method Not Allowed

    使用如下代码时,会报错,服务端使用nginx加了一个重定向wus/v1/ => public/index.php?version=v1

    $client = Client::create('http://xxxx/wus/v1/', false); $client->xxx();

    不知道怎么处理?

    opened by ycaihappy 6
  • composer怎么安装v3.0的版本

    composer怎么安装v3.0的版本

    composer怎么安装v3.0的版本,目前下载下来的还是2.0.40的版本

    opened by tianya441523 1
  • hprose能否支持stream响应,在获取数据量很大时候用

    hprose能否支持stream响应,在获取数据量很大时候用

    例如我需要获取一个很大的数据集,拿回来进行过滤、转换再保存成特定的格式。如果响应数据很大,内存会爆掉。

    目前可以使用分页解决,分割成多个小数据获取在进行合并。但逻辑会很麻烦。

    能否支持流数据响应(stream response)。 例如:guzzle stream。 https://docs.guzzlephp.org/en/stable/request-options.html#stream

    opened by hawkcraw 4
  • 协程Future\co,yield偶发返回promise对象。

    协程Future\co,yield偶发返回promise对象。

    文档中说 yield 关键字在这里的作用就是,可以等待调用完成并返回 promise 所包含的值 但是在实际上运行上,yield偶发返回promise对象。

    opened by newinternetboy 2
  • 怎么重启已经启动的tcp服务

    怎么重启已经启动的tcp服务

    开启tcp服务,链接成功了然后更新了代码重启,不知道如何重启服务

    opened by wind13602794052 1
  • 报错 找不到这个类 Hprose\BytesIO

    报错 找不到这个类 Hprose\BytesIO

    PHP Fatal error: Uncaught Error: Class 'Hprose\BytesIO' not found in /www/hprose-php/src/Hprose/RPC/Core/DefaultServiceCodec.php:31

    代码

    addCallable("hello", "hello"); $server = new HttpServer(); $service->bind($server); $server->listen(); ~
    opened by 2102237144 3
  • 2.0按照示例做报错啊Exception Argument func must be callable.

    2.0按照示例做报错啊Exception Argument func must be callable.

    namespace App\Http\Controllers;

    use Hprose\Http\Server;

    class Test { public function index() { $server = new Server(); $server->addFunction('hello'); $server->start();

    }
    
    function hello($name) {
        return "Hello $name!";
    }
    

    }

    Exception Argument func must be callable.

    Snipaste_2020-06-27_11-26-35

    opened by zxh451200 2
  • 3.0版本的client计划支持批量调用吗?

    3.0版本的client计划支持批量调用吗?

    批量调用A\B\C三个server,类似这样。

    opened by lingyun92 1
  • Es17

    Es17"Wrong Request: "z,请问各位大神这个是怎么回事呀

    我是按照这里配置的 https://www.jianshu.com/p/f028c230174c 环境是 laravel5.6 php7 我的请求地址是http://www.qingfen.com/api/service,因为我把laravel虚拟主机的入口设置成www.qingfen.com了,测试的时候没有出现“Fa1{s5”test”}z” 我的

    opened by zxh451200 5
  • PHP7.4 下2.0版本数组语法问题

    PHP7.4 下2.0版本数组语法问题

    由于PHP7.4 不在支持 {0}这种数组写法,hprose2.0中有部份数组使用的大括号下标来表示数组;从而导致php7.4版本下报错;

    opened by hongbin-hsu 3
  • 有谁测过php版本能与C#版互相调用吗

    有谁测过php版本能与C#版互相调用吗

    有谁测过php版本能与C#版互相调用吗

    opened by zznan0o0 2
Releases(v2.0.36)
Owner
Hprose
Hprose is a High Performance Remote Object Service Engine.
Hprose
PHP Machine Learning library

PHP-ML - Machine Learning library for PHP Fresh approach to Machine Learning in PHP. Algorithms, Cross Validation, Neural Network, Preprocessing, Feat

Jorge Casas 96 Jun 13, 2021
PHP Expression Language

PHP Expression Language The purpose of this library is to provide a common base for an PHP Expression Language. This is not really a creative library

KitanoLabs 32 Oct 26, 2020
HLedger is cross-platform accounting software for both power users and folks new to accounting

HLedger Plain Text Accounting on Nextcloud HLedger is cross-platform accounting software for both power users and folks new to accounting. It's good f

Ryan Boder 5 May 31, 2021
jMQTT is a plugin for Jeedom aiming to connect Jeedom to an MQTT broker to subscribe and publish messages

jMQTT is a plugin for Jeedom aiming to connect Jeedom to an MQTT broker to subscribe and publish messages

null 13 Jun 2, 2021
Simple customizable captcha script for bot prevention in php language.

phpCaptcha Simple customizable captcha script for bot prevention in php language. Usage <?php session_start(); $status = ""; if ($_SESSION['captcha']

Филип Арсовски 5 May 29, 2021
PHP Regular expressions made easy

PHPVerbalExpressions ported from VerbalExpressions VerbalExpressions is a PHP library that helps to construct hard regular expressions. Installation T

null 2.4k May 24, 2021
Lambda calculus interpreter in PHP.

lambda-php Lambda calculus interpreter in PHP. Lambda calculus Lambda calculus is a very minimal programming language that was invented in 1936 by Alo

Igor 21 Apr 11, 2020
:globe_with_meridians: List of all countries with names and ISO 3166-1 codes in all languages and data formats.

symfony upgrade fixer • twig gettext extractor • wisdom • centipede • permissions handler • extraload • gravatar • locurro • country list • transliter

Saša Stamenković 4.7k Jun 10, 2021
A multithreaded application server for PHP, written in PHP.

appserver.io, a PHP application server This is the main repository for the appserver.io project. What is appserver.io appserver.io is a multithreaded

appserver.io 937 Jun 1, 2021
A framework agnostic PHP library to build chat bots

BotMan If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course. About BotMa

BotMan 5.4k Jun 18, 2021
⚡️Lightning-fast linter for .env files. Written in Rust 🦀

⚡️ Lightning-fast linter for .env files. Written in Rust ?? Dotenv-linter can check / fix / compare .env files for problems that may cause the applica

null 946 Jun 13, 2021
RMT is a handy tool to help releasing new version of your software

RMT - Release Management Tool RMT is a handy tool to help releasing new versions of your software. You can define the type of version generator you wa

Liip 430 Jun 13, 2021
All PHP functions, rewritten to throw exceptions instead of returning false

Safe PHP This project is deprecated Because of how this project needs to be in sync with the official PHP documentation, maintaining a set of function

TheCodingMachine 1.8k Jun 16, 2021
Fluent regular expressions in PHP

FLUX (Fluent Regex) 0.5.2 by Selvin Ortiz Description Fluent Regular Expressions in PHP inspired by and largely based on VerbalExpressions:JS by Jesse

Selvin Ortiz 333 Apr 29, 2021