{"id":19756835,"url":"https://github.com/imiphp/imi-zookeeper","last_synced_at":"2026-01-26T00:40:40.020Z","repository":{"id":58283064,"uuid":"530454856","full_name":"imiphp/imi-zookeeper","owner":"imiphp","description":"imi 框架 ZooKeeper 组件。imi ZooKeeper component.","archived":false,"fork":false,"pushed_at":"2022-09-02T07:44:05.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"2.1","last_synced_at":"2025-07-08T10:11:27.797Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imiphp.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":"2022-08-30T01:30:53.000Z","updated_at":"2024-12-16T03:21:57.000Z","dependencies_parsed_at":"2022-09-01T10:12:10.464Z","dependency_job_id":null,"html_url":"https://github.com/imiphp/imi-zookeeper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/imiphp/imi-zookeeper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imiphp%2Fimi-zookeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imiphp%2Fimi-zookeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imiphp%2Fimi-zookeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imiphp%2Fimi-zookeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imiphp","download_url":"https://codeload.github.com/imiphp/imi-zookeeper/tar.gz/refs/heads/2.1","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imiphp%2Fimi-zookeeper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28762985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T00:37:26.264Z","status":"ssl_error","status_checked_at":"2026-01-26T00:37:25.959Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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-12T03:17:06.574Z","updated_at":"2026-01-26T00:40:40.003Z","avatar_url":"https://github.com/imiphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# imi-zookeeper\n\n[![Latest Version](https://img.shields.io/packagist/v/imiphp/imi-zookeeper.svg)](https://packagist.org/packages/imiphp/imi-zookeeper)\n[![Php Version](https://img.shields.io/badge/php-%3E=7.4-brightgreen.svg)](https://secure.php.net/)\n[![Swoole Version](https://img.shields.io/badge/swoole-%3E=4.8.0-brightgreen.svg)](https://github.com/swoole/swoole-src)\n[![IMI License](https://img.shields.io/github/license/imiphp/imi-zookeeper.svg)](https://github.com/imiphp/imi-zookeeper/blob/master/LICENSE)\n\n## 介绍\n\n此项目是 imi 框架的 ZooKeeper 组件。\n\n\u003e 正在开发中，随时可能修改，请勿用于生产环境！\n\n**支持的功能：**\n\n* [x] 配置中心\n\n## 安装\n\n### PHP 扩展\n\n* Swoole 用户请安装 [swoole-zookeeper](https://github.com/swoole/ext-zookeeper) 扩展。\n\n* 非 Swoole 用户请安装 [php-zookeeper](\u003chttps://github.com/php-zookeeper/php-zookeeper\u003e) 扩展。\n\n### 本组件\n\n本项目可以使用composer安装，遵循psr-4自动加载规则，在你的 `composer.json` 中加入下面的内容:\n\n```json\n{\n    \"require\": {\n        \"imiphp/imi-zookeeper\": \"~2.1.0\"\n    }\n}\n```\n\n然后执行 `composer update` 安装。\n\n## 使用说明\n\n### 配置\n\n`@app.beans`：\n\n```php\n[\n    'ConfigCenter' =\u003e [\n        // 'mode'    =\u003e \\Imi\\ConfigCenter\\Enum\\Mode::WORKER, // 工作进程模式\n        'mode'    =\u003e \\Imi\\ConfigCenter\\Enum\\Mode::PROCESS, // 进程模式\n        'configs' =\u003e [\n            'zookeeper' =\u003e [\n                'driver'  =\u003e \\Imi\\ZooKeeper\\Config\\SwooleZooKeeperConfigDriver::class, // Swoole 驱动\n                // 'driver'  =\u003e \\Imi\\ZooKeeper\\Config\\ZooKeeperConfigDriver::class, // 非 Swoole 驱动\n                // 客户端连接配置\n                'client'  =\u003e [\n                    'host'    =\u003e env('IMI_ZOOKEEPER_HOST', '127.0.0.1:2181'), // 主机名:端口\n                    'timeout' =\u003e 10, // 网络请求超时时间，单位：秒\n                ],\n                // 监听器配置\n                'listener' =\u003e [\n                    'timeout'         =\u003e 30000, // 配置监听器长轮询超时时间，单位：毫秒\n                    'failedWaitTime'  =\u003e 3000, // 失败后等待重试时间，单位：毫秒\n                    'savePath'        =\u003e Imi::getRuntimePath('config-cache'), // 配置保存路径，默认为空不保存到文件。php-fpm 模式请一定要设置！\n                    'fileCacheTime'   =\u003e 30, // 文件缓存时间，默认为0时不受缓存影响，此配置只影响 pull 操作。php-fpm 模式请一定要设置为大于0的值！\n                    'pollingInterval' =\u003e 10000, // 客户端轮询间隔时间，单位：毫秒\n                ],\n                // 配置项\n                'configs' =\u003e [\n                    'zookeeper' =\u003e [\n                        'key'   =\u003e 'imi-zooKeeper-key1',\n                        'type'  =\u003e 'json', // 配置内容类型\n                    ],\n                ],\n            ],\n        ],\n    ],\n]\n```\n\n### 获取配置\n\n```php\n\\Imi\\Config::get('zookeeper'); // 对应 imi-zooKeeper-key1\n```\n\n### 写入配置\n\n```php\n/** @var \\Imi\\ConfigCenter\\ConfigCenter $configCenter */\n$configCenter = App::getBean('ConfigCenter');\n$name = 'imi-zooKeeper-key1';\n$value = json_encode(['imi' =\u003e 'niubi']);\n$configCenter-\u003egetDriver('zookeeper')-\u003epush($name, $value);\n```\n\n## 社群\n\n**imi 框架交流群：** 17916227 [![点击加群](https://pub.idqqimg.com/wpa/images/group.png \"点击加群\")](https://jq.qq.com/?_wv=1027\u0026k=5wXf4Zq)\n\n**微信群：**\n\n\u003cimg src=\"https://github.com/imiphp/imi/raw/2.1/res/wechat.png\" alt=\"imi\" width=\"256px\" /\u003e\n\n**打赏赞助：** \u003chttps://www.imiphp.com/donate.html\u003e\n\n## 运行环境\n\n* [PHP](https://php.net/) \u003e= 7.4\n* [Composer](https://getcomposer.org/) \u003e= 2.0\n* [Swoole](https://www.swoole.com/) \u003e= 4.8.0\n* [imi](https://www.imiphp.com/) \u003e= 2.1\n\n## 版权信息\n\n`imi-zookeeper` 遵循 MIT 开源协议发布，并提供免费使用。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimiphp%2Fimi-zookeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimiphp%2Fimi-zookeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimiphp%2Fimi-zookeeper/lists"}