{"id":19621612,"url":"https://github.com/pkg6/laravel-hprose","last_synced_at":"2026-03-05T10:02:55.980Z","repository":{"id":121600962,"uuid":"610644404","full_name":"pkg6/laravel-hprose","owner":"pkg6","description":"Laravel Hprose","archived":false,"fork":false,"pushed_at":"2025-05-20T06:13:24.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-15T15:09:11.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pkg6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-07T07:32:49.000Z","updated_at":"2025-05-20T06:13:28.000Z","dependencies_parsed_at":"2024-11-11T11:26:35.045Z","dependency_job_id":"3d84223f-057d-4d83-bc59-c086be857666","html_url":"https://github.com/pkg6/laravel-hprose","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"dac0b557cf8ccfc7911bab41aee7ab30dd07f930"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pkg6/laravel-hprose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Flaravel-hprose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Flaravel-hprose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Flaravel-hprose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Flaravel-hprose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkg6","download_url":"https://codeload.github.com/pkg6/laravel-hprose/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Flaravel-hprose/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30118932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T09:35:22.236Z","status":"ssl_error","status_checked_at":"2026-03-05T09:35:20.028Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T11:23:43.846Z","updated_at":"2026-03-05T10:02:55.945Z","avatar_url":"https://github.com/pkg6.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 安装\n\n~~~\ncomposer require pkg6/laravel-hprose\n~~~\n\n## 配置文件\n\n~~~\n\u003c?php\n\nreturn [\n    //rpc 服务\n    'server' =\u003e [\n        // hprose 调试模式\n        'debug' =\u003e true,\n        //监听地址\n        'tcp_uris'       =\u003e [\n            'tcp://0.0.0.0:1314',\n        ],\n        //注册rpc 服务 目录地址\n        'route_path'     =\u003e glob(base_path(\"rpc\") . '/*.php'),\n        // 通过路由查看注册的方法\n        'http'           =\u003e [\n            // 如果设置false 在控制台显示调用方法，否在在路由显示调用方法\n            'enable'       =\u003e false,\n            //如果设置了true 这里就是路由前缀\n            'route_prefix' =\u003e 'rpc'\n        ],\n    ],\n    //rpc 客户端\n    'client' =\u003e [\n        // 服务端监听地址\n        'tcp_uris' =\u003e [\n            'tcp://127.0.0.1:1314',\n        ],\n        //是否异步\n        'async'    =\u003e false\n    ],\n];\n~~~\n\n\n## Laravel配置\n\n~~~\n//在 `config/app.php` 注册 HproseServiceProvider \n'providers' =\u003e [\n    .....\n    \\pkg6\\laravel\\Hprose\\HproseServiceProvider::class\n]\nphp artisan vendor:publish --provider=\"pkg6\\laravel\\Hprose\\HproseServiceProvider\"\n~~~\n\n## Lumen配置\n\n~~~\n将配置信息放在/config/hprose.php\n/bootstrap/app.php\n$app-\u003eregister(\\pkg6\\laravel\\Hprose\\HproseServiceProvider::class);\n$app-\u003ewithFacades();\n~~~\n\n## 服务端 方法注入，类注入以及目录下类注入 `rpc/demo.php`\n\n~~~\n\u003c?php\n\nuse pkg6\\laravel\\Hprose\\Facades\\HproseRoute;\n// 注册callback\nHproseRoute::add(function () {\n    return 'service hello';\n}, 'hello');\n// 注册class\nHproseRoute::add(\\pkg6\\laravel\\Hprose\\DemoService::class);\n\n//注册中间价\nHproseRoute::addInvokeHandler(function ($name, array \u0026$args, stdClass $context, Closure $next) {\n    $result = $next($name, $args, $context);\n    return $result;\n});\n// 注册整个目录\nHproseRoute::addPath(app_path('Services'));\n~~~\n\n## 启动rpc服务\n\n~~~\nphp artisan hprose:socket\n~~~\n\n## 客户端调用\n\n~~~\n$uris   = ['tcp://127.0.0.1:1314'];\n$client = new \\pkg6\\laravel\\Hprose\\Clients\\SocketClient($uris, false);\n$client-\u003ehello();\n\napp('hprose.socket.client')-\u003epkg6_laravel_hprose_demoservice-\u003eindex()\n\napp('hprose.socket.client')-\u003epkg6-\u003elaravel-\u003ehprose-\u003edemoservice-\u003eindex()\n~~~\n\n## 加入我们\n\n如果你认可我们的开源项目，有兴趣为 laravel-hprose 的发展做贡献，竭诚欢迎加入我们一起开发完善。无论是[报告错误](https://github.com/pkg6/laravel-hprose/issues)或是\n[Pull Request](https://github.com/pkg6/laravel-hprose/pulls) 开发，那怕是修改一个错别字也是对我们莫大的帮助。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Flaravel-hprose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkg6%2Flaravel-hprose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Flaravel-hprose/lists"}