Download the PHP package whereof/laravel-hprose without Composer

On this page you can find all versions of the php package whereof/laravel-hprose. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-hprose

安装

composer require pkg6/laravel-hprose

配置文件

<?php

return [
    //rpc 服务
    'server' => [
        // hprose 调试模式
        'debug' => true,
        //监听地址
        'tcp_uris'       => [
            'tcp://0.0.0.0:1314',
        ],
        //注册rpc 服务 目录地址
        'route_path'     => glob(base_path("rpc") . '/*.php'),
        // 通过路由查看注册的方法
        'http'           => [
            // 如果设置false 在控制台显示调用方法,否在在路由显示调用方法
            'enable'       => false,
            //如果设置了true 这里就是路由前缀
            'route_prefix' => 'rpc'
        ],
    ],
    //rpc 客户端
    'client' => [
        // 服务端监听地址
        'tcp_uris' => [
            'tcp://127.0.0.1:1314',
        ],
        //是否异步
        'async'    => false
    ],
];

Laravel配置

//在 `config/app.php` 注册 HproseServiceProvider 
'providers' => [
    .....
    \pkg6\laravel\Hprose\HproseServiceProvider::class
]
php artisan vendor:publish --provider="pkg6\laravel\Hprose\HproseServiceProvider"

Lumen配置

将配置信息放在/config/hprose.php
/bootstrap/app.php
$app->register(\pkg6\laravel\Hprose\HproseServiceProvider::class);
$app->withFacades();

服务端 方法注入,类注入以及目录下类注入 rpc/demo.php

<?php

use pkg6\laravel\Hprose\Facades\HproseRoute;
// 注册callback
HproseRoute::add(function () {
    return 'service hello';
}, 'hello');
// 注册class
HproseRoute::add(\pkg6\laravel\Hprose\DemoService::class);

//注册中间价
HproseRoute::addInvokeHandler(function ($name, array &$args, stdClass $context, Closure $next) {
    $result = $next($name, $args, $context);
    return $result;
});
// 注册整个目录
HproseRoute::addPath(app_path('Services'));

启动rpc服务

php artisan hprose:socket

客户端调用

$uris   = ['tcp://127.0.0.1:1314'];
$client = new \pkg6\laravel\Hprose\Clients\SocketClient($uris, false);
$client->hello();

app('hprose.socket.client')->pkg6_laravel_hprose_demoservice->index()

app('hprose.socket.client')->pkg6->laravel->hprose->demoservice->index()

加入我们

如果你认可我们的开源项目,有兴趣为 laravel-hprose 的发展做贡献,竭诚欢迎加入我们一起开发完善。无论是报告错误或是 Pull Request 开发,那怕是修改一个错别字也是对我们莫大的帮助。


All versions of laravel-hprose with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-json Version *
hprose/hprose Version ^v2.0
doctrine/instantiator Version ^1.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package whereof/laravel-hprose contains the following files

Loading the files please wait ....