{"id":13475753,"url":"https://github.com/youzan/zan","last_synced_at":"2025-10-24T16:21:05.835Z","repository":{"id":44395322,"uuid":"94503906","full_name":"youzan/zan","owner":"youzan","description":"高效稳定、安全易用、线上实时验证的全异步高性能网络库，通过PHP扩展方式使用。","archived":false,"fork":false,"pushed_at":"2018-04-16T02:36:39.000Z","size":4770,"stargazers_count":459,"open_issues_count":7,"forks_count":67,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-08-01T16:39:55.105Z","etag":null,"topics":["asyncio","c","muti-process","php","php-extension","reactor"],"latest_commit_sha":null,"homepage":"http://zanphp.io","language":"C","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/youzan.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":"2017-06-16T04:06:01.000Z","updated_at":"2024-07-18T07:50:48.000Z","dependencies_parsed_at":"2022-07-14T20:17:22.375Z","dependency_job_id":null,"html_url":"https://github.com/youzan/zan","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youzan%2Fzan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youzan%2Fzan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youzan%2Fzan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youzan%2Fzan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youzan","download_url":"https://codeload.github.com/youzan/zan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245760874,"owners_count":20667889,"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":["asyncio","c","muti-process","php","php-extension","reactor"],"created_at":"2024-07-31T16:01:23.237Z","updated_at":"2025-10-24T16:21:00.783Z","avatar_url":"https://github.com/youzan.png","language":"C","funding_links":[],"categories":["PHP","C","目录","异步","框架( Frameworks )","基础框架"],"sub_categories":["框架 frameworks","构建/部署"],"readme":"\u003cp\u003e\n\u003ca href=\"https://github.com/youzan/\"\u003e\u003cimg alt=\"有赞logo\" width=\"36px\" src=\"https://img.yzcdn.cn/public_files/2017/02/09/e84aa8cbbf7852688c86218c1f3bbf17.png\" alt=\"youzan\"\u003e\n\u003c/p\u003e\u003c/a\u003e\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/youzan/zanphp.io/blob/master/src/img/zan-logo-small@2x.png?raw=true\" alt=\"zanphp logo\" srcset=\"https://github.com/youzan/zanphp.io/blob/master/src/img/zan-logo-small.png?raw=true 1x, https://github.com/youzan/zanphp.io/blob/master/src/img/zan-logo-small@2x.png?raw=true 2x, https://github.com/youzan/zanphp.io/blob/master/src/img/zan-logo-small.png?raw=true\" width=\"210\" height=\"210\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e高效稳定、安全易用、线上实时验证的全异步高性能网络库，通过PHP扩展方式提供。\u003c/p\u003e\n\u003cp align=\"center\"\u003e遵循Apache协议，基于Swoole 1.8.5版本分支重构研发。\u003c/p\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e在此特别鸣谢Swoole开发组为PHP开源社区付出的努力和汗水。\u003c/p\u003e\n\n[![License](https://img.shields.io/badge/license-apache2-blue.svg)](LICENSE)\n[![Build Status](https://api.travis-ci.org/youzan/zan.svg)](https://travis-ci.org/youzan/zan)\n\n\n## Zan做了哪些事儿\n1.  大量模块解耦拆分\n2.  修复大量Bug、逻辑缺陷(内存泄露、释放逻辑)\n3.  内置通用连接池\n4.  支持时间轮算法\n5.  异步接口支持超时\n6.  增强Mysql client安全性(预处理、事务)\n7.  Nova协议支持(RPC协议)\n8.  支持平滑重启\n9.  接口单元测试覆盖率100%\n10. 实时、全面的API文档\n11. ...\n\n\n\n## 编译安装步骤\n\n**master分支做了较大改动，还在内测阶段，不建议上生产环境，如果要求稳定，可以下载release版本**\n\n```\ngit clone https://github.com/youzan/zan.git\ncd zan-extension\nphpize\n./configure\nmake \nmake install\n```\n\n## 建议安装配置项\n```\nphpize \n./configure --enable-openssl\nmake \nmake install\n```\n\n## Zan编译安装常见问题\n1.  使用async-redis客户端及依赖sockets扩展默认打开，使用ssl功能默认不打开。\n    1. 若不想使用async-redis客户端，可在configure时采用选项```--disable-async-redis```关闭。\n    2. 使用async-redis客户端需要安装hiredis库，当前默认已提供x86下linux/mac的hiredis库。若需要支持arm等硬件平台，需要先安装hiredis库，然后在config.m4文件中添加```PHP_ADD_LIBRARY(hiredis, 1, ZAN_SHARED_LIBADD)```将其编译进ZAN扩展。\n    3. 若想使用ssl功能，可在configure时采用选项```--enable-openssl```开启。\n2.  若执行phpize报xxx/sed: No such file，请重装php或将/usr/bin/sed拷贝到xxx目录下。\n3.  若执行phpize报Cannot find autoconf，请先安装autoconf工具。\n4.  若执行configure时报错libcurl not installed，请重新安转curl库，并保证库与头文件名称与路径正确。\n    1. 如库名称与路径/usr/lib/libcurl.so(通常带版本号的libxxx.so.xxx会软连接到libXXX.so供链接器识别)，对应头文件路径则为/usr/include/curl。\n    2. 确认curl库正确安装后，请务必重新phpize \u0026\u0026 configure以保证新的配置生效。\n    3. 若按1)、2)操作后仍然报错，则可修改config.m4中PHP_CURL的配置路径为你安装curl的路径。\n5.  若执行configure时报错enable sockets support, sockets extension installed incorrectly，请确认PHP版本及sockets扩展正确安装。\n    1. PHP版本需要在5.6以上版本。\n    2. 在PHP的include路径下应该包含头文件ext/sockets/php_sockets.h。\n    3. sockets扩展在zan之前加载(php.ini中的引入加载顺序)，以确保能引用符号表信息。\n6.  若执行configure时报错Enable openssl support, require openssl library，请重新安装openssl库并保证能链接正确。\n    1. 重新安装openssl库。\n    2. 添加openssl库路径供链接器找lib，如将```-L/usr/local/opt/openssl/lib```补充到config.m4中的LDFLAGS。\n    3. 添加openssl库依赖头文件路径，如将```-I/usr/local/opt/openssl/include```添加到config.m4中的CPPFLAGS。\n    4. 依然需要重新配置，按编译扩展步骤安装，见上方。\n\n## 官方交流渠道\n官网：[点我进入](http://zanphp.io)\n\nZan 的文档仓库地址：[zan-doc](https://github.com/youzan/zan-doc/)\n\n在线查看文档：[http://zandoc.zanphp.io ✈](http://zandoc.zanphp.io)\n\nQQ群：115728122\n\n\n## 常用链接\n- [异步网络模型](http://tech.youzan.com/yi-bu-wang-luo-mo-xing/)\n- [PHP异步编程: 手把手教你实现co与Koa](https://github.com/youzan/php-co-koa) \n- [深入理解PHP opcode优化](http://tech.youzan.com/understanding-opcode-optimization-in-php/) \n- [Zan-Stats监控工具](https://github.com/imaben/zan-stats) \n\n\n## 捐赠我们\n[捐赠通道](http://zanphp.io/donate)\n\n## License\n\n[Zan 框架](https://github.com/youzan/zan)基于 [Apache2.0 license](http://www.apache.org/licenses/LICENSE-2.0) 进行开源。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouzan%2Fzan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyouzan%2Fzan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouzan%2Fzan/lists"}