{"id":18737270,"url":"https://github.com/zyprosoft/hyperf-skeleton","last_synced_at":"2025-04-12T19:32:19.463Z","repository":{"id":50579237,"uuid":"415918433","full_name":"zyprosoft/hyperf-skeleton","owner":"zyprosoft","description":"基于hyperf-common基础封装的脚手架工程，开箱即用的后台服务构建脚手架","archived":false,"fork":false,"pushed_at":"2024-10-17T10:06:58.000Z","size":166,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T14:02:54.608Z","etag":null,"topics":["hyperf"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zyprosoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-10-11T12:34:08.000Z","updated_at":"2024-10-17T10:06:09.000Z","dependencies_parsed_at":"2024-10-19T08:30:29.447Z","dependency_job_id":"2b4f88f0-8b5a-4a43-99c9-3472a930f54c","html_url":"https://github.com/zyprosoft/hyperf-skeleton","commit_stats":{"total_commits":50,"total_committers":4,"mean_commits":12.5,"dds":0.4,"last_synced_commit":"adc7dd670c043c649ac9e40f71b44ae6e51fcd47"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyprosoft%2Fhyperf-skeleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyprosoft%2Fhyperf-skeleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyprosoft%2Fhyperf-skeleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyprosoft%2Fhyperf-skeleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zyprosoft","download_url":"https://codeload.github.com/zyprosoft/hyperf-skeleton/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248621269,"owners_count":21134792,"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":["hyperf"],"created_at":"2024-11-07T15:24:30.351Z","updated_at":"2025-04-12T19:32:19.131Z","avatar_url":"https://github.com/zyprosoft.png","language":"PHP","readme":"# hyperf-skeleton\n\n###项目背景\n\n1. 基于zyprosoft/hyperf-common建立的脚手架，用于快速生成一个支持zgw协议的后台开发项目模板\n\n\n###ZGW协议开发\n\n####\n内部库\n\n####一、使用zyprosoft/hyperf-skeleton项目来创建脚手架\n1. composer create-project zyprosoft/hyperf-skeleton\n2. 完成后执行composer install\n\n####ZGW协议接口开发\n三段式接口名：大模块名.控制器.方法\n使用AutoController(prefix=\"大模块名/控制器\")进行注解之后，\n按照ZGW协议请求便可自动调用到对应的方法\n如下示范:ZgwController下使用AutoController(prefix=\"/common/zgw\")进行注解之后便可\n请求到sayHello方法\n```php\ncurl -d'{\n    \"version\":\"1.0\",\n    \"seqId\":\"xxxxx\",\n    \"timestamp\":1601017327,\n    \"eventId\":1601017327,\n    \"caller\":\"test\",\n    \"interface\":{\n        \"name\":\"common.zgw.sayHello\",\n        \"param\":{}\n    }\n}' http://127.0.0.1:9506\n```\n\n####普通协议开发可直接按照想要的路径做AutoController注解即可\n\n####根据需求继承需要鉴权和不需要鉴权的Request\nAdminRequest:需要管理员身份的请求\nAuthedRequest:需要登陆身份的请求\n\n####zgw协议请求内容防篡改\n签名算法:\n在hyperf-common.php配置好appId和appSecret\n第一步:生成当前时间戳timestamp和随机字符串nonce\n第二步:取出协议中的interface.name和param, php eg. ```$name = $reqBody['interface']['name']```;\n第三步:将第一步取出的参数按照如下加入到param, php eg. ```$param['interfaceName'] = $name```;\n第四步:将第二步的param参数按照首字母升序 \n第五步:将第四部参数数组json编码后进行md5编码得到参数字符串paramString,注意这里json编码不要主动编码为Unicode,不转义/字符\n第六步:按照下面的格式拼接参数:\nappId=$appId\u0026appSecret=$appSecret\u0026nonce=$nonce\u0026timestamp=$timestamp\u0026$paramString;\n第七步:用appSecret和第六步字符串采用sha256算法算出签名\n第八步:将得到的签名使用参数名signature加入到请求协议的外层即可\n\n重点:如果是接口带文件上传，需要将上述得到的auth和interface字段进行json编码,后端会在获取到请求的时候自动解码\n\n参考请求包\n```php\ncurl -d'{\n    \"auth\":{\n       \"timestamp\":1601017327,\n       \"nonce\":\"1601017327\",\n       \"appId\":\"test\",\n       \"signature\":\"xxasdfsfdsfffg\"\n    },\n    \"version\":\"1.0\",\n    \"seqId\":\"xxxxx\",\n    \"timestamp\":1601017327,\n    \"eventId\":1601017327,\n    \"caller\":\"test\",\n    \"interface\":{\n        \"name\":\"common.zgw.sayHello\",\n        \"param\":{}\n    }\n}' http://127.0.0.1:9506\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzyprosoft%2Fhyperf-skeleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzyprosoft%2Fhyperf-skeleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzyprosoft%2Fhyperf-skeleton/lists"}