{"id":19638018,"url":"https://github.com/simon28082/client","last_synced_at":"2025-10-26T14:04:40.155Z","repository":{"id":56958805,"uuid":"150845167","full_name":"simon28082/client","owner":"simon28082","description":"Http Tcp Websocket client","archived":false,"fork":false,"pushed_at":"2019-01-14T07:50:49.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-10T02:34:59.853Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simon28082.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}},"created_at":"2018-09-29T08:53:35.000Z","updated_at":"2019-01-14T07:50:50.000Z","dependencies_parsed_at":"2022-08-21T05:10:25.589Z","dependency_job_id":null,"html_url":"https://github.com/simon28082/client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon28082%2Fclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon28082%2Fclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon28082%2Fclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simon28082%2Fclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simon28082","download_url":"https://codeload.github.com/simon28082/client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240941516,"owners_count":19882063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-11T12:37:24.711Z","updated_at":"2025-10-26T14:04:40.088Z","avatar_url":"https://github.com/simon28082.png","language":"PHP","readme":"# 远程调用的统一客户端\n\n## 使用方法\n\n### 加载引入\n\n\u003e 如果您的Larvel版本\u003e5.5可忽略此设置\n\n在`config/app.php`中增加\n```\n'providers' =\u003e [\n    CrCms\\Foundation\\ConnectionPool\\PoolServiceProvider::class,\n    CrCms\\Foundation\\Client\\ClientServiceProvider::class,\n]\n```\n\n### 增加配置\n\n在`config/client.php`的`connections`中增加如下测试配置\n```\n'http' =\u003e [\n    'driver' =\u003e 'http',\n    'host' =\u003e 'blog.crcms.cn',\n    'port' =\u003e 80,\n    //资源连接器的配置，请参考guzzlehttp\n    'settings' =\u003e [\n        'timeout' =\u003e 1,\n    ],\n],\n```\n\n### 调用方法\n```\n//实例化并设置连接\n$client = $this-\u003eapp-\u003emake('client.manager')-\u003econnection('http');\n//发送请求\n$client = $client-\u003erequest('/',[]);\n//获取当前连接\ndump(get_class($client-\u003egetConnection()));\n//获取连接池管理器\ndump(get_class($client-\u003egetConnectionPoolManager()));\n//获取当前的连接资源的响应\ndump(get_class($client-\u003egetResponse()));\n//获取资源响应内容\ndd($client-\u003egetContent());\n```\n\n### 动态化配置\n```\n$client = $this-\u003eapp-\u003emake('client.manager')-\u003econnection([\n    'name' =\u003e 'http',\n    'driver' =\u003e 'http',\n    'host' =\u003e '192.168.1.12',\n    'port' =\u003e 8500,\n    'settings' =\u003e [\n        'timeout' =\u003e 1,\n    ],\n]);\n```\n\n### 使用连接池\n\n在`config/pool.php`的`connections`中增加配置(可选增加)\n```\n'client' =\u003e [\n    'max_idle_number' =\u003e 50,//最大空闲数\n    'min_idle_number' =\u003e 15,//最小空闲数\n    'max_connection_number' =\u003e 20,//最大连接数\n    'max_connection_time' =\u003e 3,//最大连接时间(s)\n],\n```\n\n\u003e **使用连接池时，以当前连接名称做为连接池名称**\n\n## 支持的类型\n- Http\n\n## 后期增加\n- Tcp\n- WebSocket\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimon28082%2Fclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimon28082%2Fclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimon28082%2Fclient/lists"}