Compare commits

...

443 Commits

Author SHA1 Message Date
crazywhalecc
fb936e97ac remove prefer for composer 2022-12-20 23:49:41 +08:00
crazywhalecc
8ca4f7400a increment build number (build 638) 2022-12-20 15:46:29 +00:00
Jerry
61b48676ae Merge pull request #188 from zhamao-robot/v3-beta1
Beta 1 发布
2022-12-20 23:45:43 +08:00
crazywhalecc
257e59b79f remove debug log 2022-12-20 23:42:29 +08:00
crazywhalecc
c19791c31d remove debug log 2022-12-20 23:41:58 +08:00
crazywhalecc
c99747c1f6 add class alias helper generate command 2022-12-20 23:36:43 +08:00
crazywhalecc
a9b6989966 Merge remote-tracking branch 'origin/v3-beta1' into v3-beta1
# Conflicts:
#	src/Globals/global_class_alias.php
2022-12-20 23:22:55 +08:00
crazywhalecc
c9bf0fb13c prerelease of beta1 2022-12-20 23:19:55 +08:00
sunxyw
04247048d4 increment build number (build 637) 2022-12-20 15:05:27 +00:00
sunxyw
b2a6c2f5e0 add container class_alias support (#189) 2022-12-20 23:04:26 +08:00
crazywhalecc
865c306e14 prerelease of beta1 2022-12-20 20:10:40 +08:00
sunxyw
588fc919d9 increment build number (build 636) 2022-12-19 12:23:38 +00:00
sunxyw
8ff7da4d23 PHP80 小修 (#187)
* migrate-php80

fix styles
fix static analyse

* fix some bugs
2022-12-19 20:22:47 +08:00
sunxyw
da516b487d update readme test badge src (#186) 2022-12-19 15:20:01 +08:00
crazywhalecc
06615cbb29 increment build number (build 635) 2022-12-19 06:02:03 +00:00
crazywhalecc
463ee0cced update api docs 2022-12-19 06:01:59 +00:00
Jerry
208ccd6642 Merge pull request #185 from zhamao-robot/plugin-update-post
完善插件加载系统
2022-12-19 14:01:02 +08:00
crazywhalecc
cd2bb1b570 add plugin loader support 2022-12-19 01:45:27 +08:00
crazywhalecc
52a195aca2 fix DBException syntax error 2022-12-19 01:43:47 +08:00
crazywhalecc
fbc3cf00a2 increment build number (build 634) 2022-12-18 12:14:53 +00:00
crazywhalecc
ede5f456a8 update api docs 2022-12-18 12:14:51 +00:00
Jerry
2633e91d4d Merge pull request #184 from zhamao-robot/plugin-update-pre
插件和 OneBot 12 适配器前置内容
2022-12-18 20:13:50 +08:00
crazywhalecc
39b3a74d34 refactor with php-libonebot factory classes 2022-12-18 18:33:51 +08:00
crazywhalecc
3ecd224ce6 separate onebot 12 adapter things 2022-12-18 18:31:35 +08:00
sunxyw
49c7033eaa update dependencies (#180)
* update dependencies

* revert swoole-helper update
2022-12-18 15:58:48 +08:00
crazywhalecc
20ca848df9 increment build number (build 633) 2022-12-17 16:42:49 +00:00
crazywhalecc
5b0e3ed636 update api docs 2022-12-17 16:42:47 +00:00
Jerry
14840715bc Merge pull request #181 from zhamao-robot/8.0-upgrade
兼容 8.x PHP 一些改动
2022-12-18 00:41:56 +08:00
crazywhalecc
ed4537e5d5 update some strict parameters and separate easter eggs 2022-12-18 00:17:28 +08:00
crazywhalecc
58d4b4427d update default download native php to 8.1 2022-12-18 00:15:55 +08:00
crazywhalecc
8c6aba9361 rename Instant to ZM 2022-12-18 00:15:34 +08:00
crazywhalecc
1173949bba rename Instant to ZM 2022-12-18 00:15:19 +08:00
crazywhalecc
279956456c remove unused files 2022-12-18 00:11:54 +08:00
crazywhalecc
3f8c557a96 add requirement tokenizer 2022-12-18 00:11:33 +08:00
sunxyw
ff93201ab1 increment build number (build 632) 2022-12-17 16:00:09 +00:00
sunxyw
cd94539e99 update api docs 2022-12-17 16:00:07 +00:00
sunxyw
adc1d176e3 Merge pull request #179 from zhamao-robot/migrate-symfony-console-v6
迁移 Symfony Console V6
2022-12-17 23:59:19 +08:00
sunxyw
44c25f7fdd make commands lazily loaded 2022-12-17 22:30:19 +08:00
sunxyw
3806983bc2 change commands definition to attribute 2022-12-17 21:53:24 +08:00
sunxyw
c6f877700e add contributing document (#178) 2022-12-17 19:45:04 +08:00
sunxyw
c2fb90dfc7 increment build number (build 631) 2022-12-17 11:43:42 +00:00
sunxyw
ca61e6a238 update api docs 2022-12-17 11:43:41 +00:00
sunxyw
9399e54da8 Merge pull request #176 from zhamao-robot/docker-compose-support
增加 Docker Compose 支持
2022-12-17 19:42:42 +08:00
sunxyw
385f217b96 remove symfony/polyfill-php80 2022-12-17 16:29:28 +08:00
sunxyw
65bb6a2473 improve Command phpdoc 2022-12-17 16:27:49 +08:00
sunxyw
a430cf59c4 add docker init to InitCommand 2022-12-16 21:58:19 +08:00
sunxyw
4bf328ef67 refactor InitCommand 2022-12-16 18:05:51 +08:00
sunxyw
ebb724415d split InitException to SingletonViolationException 2022-12-16 17:59:12 +08:00
sunxyw
daa07dcb2b add docker compose support 2022-12-16 15:29:10 +08:00
sunxyw
635f081437 increment build number (build 630) 2022-11-18 07:22:16 +00:00
sunxyw
c7b4ca2a82 Merge pull request #173 from zhamao-robot/advance-exception
改进异常
2022-11-18 15:21:33 +08:00
sunxyw
b5c91531fa fix comment position 2022-11-18 15:16:48 +08:00
sunxyw
8199e91ce0 remove todo from InterruptException 2022-11-17 21:11:11 +08:00
sunxyw
44c32c1711 fix styles 2022-11-15 23:14:31 +08:00
sunxyw
5a3da43640 fix unused argument 2022-11-15 23:11:24 +08:00
sunxyw
352f3e920e deprecate ZMKnownException 2022-11-15 21:51:15 +08:00
sunxyw
5f4a00c77e refactor ZMException 2022-11-15 21:48:46 +08:00
crazywhalecc
aeea6f5dc1 increment build number (build 629) 2022-11-14 02:10:52 +00:00
Jerry
ea74a531b4 Merge pull request #172 from zhamao-robot/orgianze-bootstrap
重新组织 Bootstraper
2022-11-14 10:09:52 +08:00
sunxyw
02003b2bd3 reduce useless method 2022-11-12 01:15:40 +08:00
sunxyw
723dfd30a2 fix styles 2022-11-08 17:33:25 +08:00
sunxyw
aa29dc99f3 orgianze bootstrapper 2022-11-08 17:28:07 +08:00
crazywhalecc
74ba4d0145 increment build number (build 628) 2022-11-06 02:15:29 +00:00
crazywhalecc
5705f5227f update api docs 2022-11-06 02:15:28 +00:00
Jerry
3bb34b46ee Merge pull request #170 from zhamao-robot/proxy-server
添加代理、升级到 PHP8.0
2022-11-06 10:14:47 +08:00
crazywhalecc
4d0ea99f47 fix posix killer 2022-11-04 12:35:17 +08:00
sunxyw
fe70c07113 Merge pull request #171 from zhamao-robot/update-workflow
更新Workflow
2022-11-04 11:36:49 +08:00
sunxyw
27c6bf1864 add PHP8.2 support 2022-11-03 17:37:52 +08:00
sunxyw
f4ded4c6d7 drop PHP7.4 support 2022-11-03 17:36:09 +08:00
sunxyw
4a2c7f5ecb bump fkirc/skip-duplicate-actions to v5 2022-11-03 17:35:38 +08:00
crazywhalecc
7a051380e2 fix php version requirements 2022-11-03 10:36:08 +08:00
crazywhalecc
35dec947df add proxy server command and update lowest version of PHP >= 8.0 2022-11-03 10:18:17 +08:00
crazywhalecc
6b34427855 increment build number (build 627) 2022-10-02 10:35:36 +00:00
crazywhalecc
59a9f30089 update api docs 2022-10-02 10:35:35 +00:00
Jerry Ma
779564ebb6 Merge pull request #169 from zhamao-robot/state-and-windows
add state and ctrl+C support for windows
2022-10-02 18:34:49 +08:00
crazywhalecc
a4f992b9e5 add state and ctrl+C support for windows 2022-09-26 22:44:41 +08:00
sunxyw
cf3f09600b increment build number (build 626) 2022-09-23 14:12:45 +00:00
sunxyw
83c1d63408 update api docs 2022-09-23 14:12:42 +00:00
sunxyw
43337c34c8 fix config upstream changes (#168) 2022-09-23 22:11:26 +08:00
crazywhalecc
bb431ccf53 increment build number (build 625) 2022-09-23 09:09:14 +00:00
crazywhalecc
ba69cc93ee update api docs 2022-09-23 09:09:12 +00:00
Jerry Ma
406de8f4df Merge pull request #167 from zhamao-robot/fix-relative-path-check-in-windows
修复 isRelativePath 在 Windows 环境判断相反的 Bug
2022-09-23 17:08:13 +08:00
crazywhalecc
fd05fe6e25 fix 2022-09-23 12:50:44 +08:00
sunxyw
10a0ee9142 increment build number (build 624) 2022-09-11 11:33:47 +00:00
sunxyw
836d4dc1ef Merge pull request #165 from zhamao-robot/refactor-workflow
重构 Workflow
2022-09-11 19:32:56 +08:00
sunxyw
a18fcdb21e adjust workflow php version 2022-09-10 16:04:15 +08:00
sunxyw
6c9cd06e4a simplify incrememt build number 2022-09-09 21:03:51 +08:00
sunxyw
44c1ac054c avoid duplicate workflow runs 2022-09-09 20:55:44 +08:00
sunxyw
9d77d60887 fix styles 2022-09-09 18:59:46 +08:00
sunxyw
8f7fd97ebe refactor workflow 2022-09-09 18:54:55 +08:00
sunxyw
87e3b2249c increment build number (build 623) 2022-08-28 06:12:39 +00:00
sunxyw
5e12af77a4 drop config array access support (#163) 2022-08-28 14:12:01 +08:00
sunxyw
47244373d7 add custom phpunit printer (#164) 2022-08-28 13:03:58 +08:00
sunxyw
a72530598a increment build number (build 622) 2022-08-27 18:20:38 +00:00
sunxyw
2679facf24 update api docs 2022-08-27 18:20:37 +00:00
sunxyw
cf9db4b0d4 add config trace (#159)
* add config trace

* fix config tracer bug
2022-08-28 02:19:26 +08:00
crazywhalecc
f341c8585e increment build number (build 621) 2022-08-27 12:34:51 +00:00
crazywhalecc
28f7b47034 update api docs 2022-08-27 12:34:50 +00:00
Jerry Ma
99954f9140 Merge pull request #162 from zhamao-robot/windows-support-relative-path
FileSystem.php isRelativePath() 对 Windows 的兼容性
2022-08-27 20:34:02 +08:00
Jerry Ma
85b21d63ed Merge pull request #161 from zhamao-robot/fix-config-overwrite-bug
修复 Framework 中 Config 重写的 Bug
2022-08-27 20:33:48 +08:00
Jerry Ma
ef443d9912 Merge pull request #160 from zhamao-robot/sqlite-support
Sqlite 支持
2022-08-27 20:33:36 +08:00
crazywhalecc
db2b22c822 FileSystem.php isRelativePath() compatibility for windows 2022-08-27 20:03:22 +08:00
crazywhalecc
24156884e4 fix config overwrite bug in framework init 2022-08-27 19:56:29 +08:00
crazywhalecc
6413567353 change global config for database 2022-08-27 19:51:09 +08:00
crazywhalecc
84f84dad40 add sqlite extensions for github action 2022-08-27 19:50:40 +08:00
crazywhalecc
dd01653da9 add SQLiteDriver.php and change MySQLDriver.php 2022-08-27 19:47:45 +08:00
crazywhalecc
085472a12c refactor MySQL component to support SQLite at the same time 2022-08-27 19:45:23 +08:00
crazywhalecc
e9b6965678 remove redundant library 2022-08-27 19:39:02 +08:00
sunxyw
1a9680c09a increment build number (build 620) 2022-08-27 08:26:49 +00:00
sunxyw
40f8fe22ee update api docs 2022-08-27 08:26:48 +00:00
sunxyw
be6002dd64 Merge pull request #157 from zhamao-robot/fix-config-loading
修正&改进配置加载
2022-08-27 16:25:43 +08:00
sunxyw
96ebb770b6 add environment aliases 2022-08-27 01:12:38 +08:00
sunxyw
9bcdb254c9 increment build number (build 619) 2022-08-26 16:54:30 +00:00
sunxyw
87e71f1eb8 add repl command (#155) 2022-08-27 00:53:45 +08:00
sunxyw
451ce104c5 fix config loading 2022-08-27 00:42:43 +08:00
sunxyw
7920711988 increment build number (build 618) 2022-08-23 15:43:41 +00:00
sunxyw
6e78f2caf2 update api docs 2022-08-23 15:43:37 +00:00
sunxyw
2727b056eb Merge pull request #146 from zhamao-robot/refactor-config
基于 LibOB Config 类重构 ZMConfig
2022-08-23 23:42:30 +08:00
sunxyw
975d0e3540 allow multiple set config 2022-08-23 18:18:20 +08:00
sunxyw
eb7e700e7c replace legacy config 2022-08-23 18:02:00 +08:00
sunxyw
18892a14c2 ready to replace legacy config 2022-08-23 17:51:20 +08:00
sunxyw
6cbde80a1c delete outdated config classes 2022-08-23 17:36:45 +08:00
sunxyw
6fc875aa72 fix windows compatibility 2022-08-23 16:00:55 +08:00
sunxyw
29f5c3c758 change confusing name global to default 2022-08-23 15:59:55 +08:00
sunxyw
afa6411004 add array replace feature 2022-08-23 15:37:31 +08:00
crazywhalecc
67526c30da increment build number (build 617) 2022-08-22 13:39:34 +00:00
Jerry Ma
dc67dbc489 Merge pull request #152 from zhamao-robot/more-windows-support
add phpunit windows support
2022-08-22 21:38:21 +08:00
crazywhalecc
05ac2feebd add windows exit code support 2022-08-22 21:32:00 +08:00
crazywhalecc
6f30c04899 fix php 7.4 stuck bug 2022-08-22 21:27:23 +08:00
crazywhalecc
dfce8e9749 remove default mysql host 2022-08-22 21:22:49 +08:00
crazywhalecc
aae326133b cs-fix 2022-08-22 21:03:33 +08:00
crazywhalecc
15383a6b92 add phpunit windows support 2022-08-22 20:54:14 +08:00
sunxyw
5d8a1deb35 add yaml and toml config support 2022-08-22 17:15:10 +08:00
sunxyw
b09d12aad5 add config patch support 2022-08-22 17:02:50 +08:00
sunxyw
488acc3e69 fix incorrect onebot namespace 2022-08-22 16:30:45 +08:00
sunxyw
32534c870d add clearer exception 2022-08-22 16:29:27 +08:00
sunxyw
74af1516ac add get file load type test 2022-08-22 16:12:50 +08:00
sunxyw
07b2f175f3 add more test cases 2022-08-22 16:12:49 +08:00
sunxyw
1a1c65afce fix code styles 2022-08-22 16:12:49 +08:00
sunxyw
90282b858e fix inappropriate config group name 2022-08-22 16:12:49 +08:00
sunxyw
f819922d8a add basic usable config 2022-08-22 16:12:48 +08:00
sunxyw
aa8fdf557e add load order to config 2022-08-22 16:12:48 +08:00
sunxyw
4896cf0ad3 simply refactor ZMConfig 2022-08-22 16:12:47 +08:00
crazywhalecc
2e61e2a366 increment build number (build 616) 2022-08-22 07:46:48 +00:00
Jerry Ma
172a7444c9 Merge pull request #151 from zhamao-robot/windows-support
修复对 Windows 环境开发的支持
2022-08-22 15:45:57 +08:00
crazywhalecc
3ea5b16487 increment build number (build 615) 2022-08-22 07:39:45 +00:00
crazywhalecc
e83a169fd6 update api docs 2022-08-22 07:39:44 +00:00
Jerry Ma
53c1c0103c Merge pull request #149 from zhamao-robot/feature/class-alias
添加类别名
2022-08-22 15:38:49 +08:00
crazywhalecc
e467402a15 fix typo 2022-08-22 15:32:29 +08:00
crazywhalecc
d5fc16dccb change arg pass 2022-08-22 15:23:41 +08:00
crazywhalecc
3be84edb5a remove swoole pdo proxy 2022-08-22 13:37:48 +08:00
crazywhalecc
fe3bb22311 add windows development support 2022-08-22 13:35:07 +08:00
sunxyw
86c2cf96a9 fix gendoc incompatibility (#150) 2022-08-22 13:06:48 +08:00
crazywhalecc
67ba8340cc cs fix 2022-08-21 20:17:05 +08:00
crazywhalecc
ac69640253 add alias 2022-08-21 20:15:55 +08:00
crazywhalecc
64965bcc93 increment build number (build 614) 2022-08-21 08:42:32 +00:00
Jerry Ma
2eb73f3746 Merge pull request #148 from zhamao-robot/feature/mysql
完善 MySQL 连接池和组件
2022-08-21 16:41:22 +08:00
crazywhalecc
8f761c31e3 reset PHPDoc 2022-08-21 16:25:05 +08:00
crazywhalecc
528b61862a remove deprecated php version for integration-test 2022-08-21 16:20:21 +08:00
crazywhalecc
c7003a7139 add mysql support 2022-08-21 16:08:20 +08:00
crazywhalecc
75e65b082e fix middleware closure reference not working 2022-08-21 16:07:01 +08:00
crazywhalecc
22d38b783d update function name, add --print-process-pid option 2022-08-21 16:05:58 +08:00
crazywhalecc
ebdada57a6 add bot crafting command 2022-08-21 16:04:20 +08:00
crazywhalecc
28f8850013 increment build number (build 613) 2022-08-20 11:00:45 +00:00
Jerry Ma
540977c637 Merge pull request #147 from zhamao-robot/refactor/phpunit-test-rebuild
Refactor/phpunit test rebuild
2022-08-20 18:59:50 +08:00
crazywhalecc
4ba74e9f3e refactor phpunit-swoole to phpunit-zm and move old test cases 2022-08-20 17:49:33 +08:00
crazywhalecc
cecdb1681c increment build number (build 612) 2022-08-15 07:07:37 +00:00
crazywhalecc
2947da2a00 update api docs 2022-08-15 07:07:36 +00:00
crazywhalecc
da6000b4da fix container and coroutine 2022-08-15 15:06:45 +08:00
crazywhalecc
8be7207c3c increment build number (build 611) 2022-08-14 10:16:55 +00:00
crazywhalecc
0a806a74b1 update api docs 2022-08-14 10:16:53 +00:00
crazywhalecc
d56f9d6e6e fix param for annotation handler 2022-08-14 18:15:45 +08:00
crazywhalecc
dc742763a8 add pipeline feature for middleware 2022-08-14 18:15:45 +08:00
crazywhalecc
0b9b87ba23 upgrade cs-check php version 2022-08-14 18:15:45 +08:00
crazywhalecc
346be22ea9 change comment 2022-08-14 18:15:45 +08:00
crazywhalecc
b2c95d96b1 refactor all base things 2022-08-14 18:15:45 +08:00
crazywhalecc
1c801bb205 remove mkdocs config 2022-08-14 18:15:45 +08:00
crazywhalecc
163d240a9c change LICENSE copyright 2022-08-14 18:15:45 +08:00
crazywhalecc
19fc3a6d40 add PhpStorm meta config 2022-08-14 18:15:45 +08:00
crazywhalecc
4c9bc002f4 update composer.json 2022-08-14 18:15:45 +08:00
crazywhalecc
b3a5d50ba8 rename bin/start to bin/zhamao 2022-08-14 18:15:45 +08:00
crazywhalecc
f7919129b6 patch 2.x new features on 3.0 2022-08-14 18:15:45 +08:00
crazywhalecc
dccb1d91e2 update docs 2022-08-14 18:15:45 +08:00
crazywhalecc
41b058aeaf update to 3.0.0-alpha2 (build 610): refactor driver 2022-08-14 18:15:45 +08:00
sunxyw
f2a12634a4 increment build number (build 609) 2022-07-09 11:51:35 +00:00
sunxyw
8d33f45388 update api docs 2022-07-09 11:51:33 +00:00
sunxyw
cb7e230214 Merge pull request #135 from zhamao-robot/replace-console-with-logger
替换 zhamao/console 为 zhamao/logger
2022-07-09 19:50:18 +08:00
sunxyw
badd05a014 skip unfit tests for now 2022-06-09 00:25:17 +08:00
sunxyw
47ffe9a2ec temporarily fix logger infinite loop 2022-06-09 00:20:58 +08:00
sunxyw
4fe74eb5fe replace console with logger 2022-06-08 23:14:25 +08:00
sunxyw
1c40896dc0 increment build number (build 608) 2022-05-31 08:34:45 +00:00
sunxyw
872b4ce1c6 update api docs 2022-05-31 08:34:43 +00:00
sunxyw
c0fed1a391 Merge pull request #133 from zhamao-robot/fix-adapter-overflow
修复 OneBot11Adapter 无限回调溢出及其他小补丁
2022-05-31 16:33:40 +08:00
sunxyw
d1f584e490 fix phpstan false positive in ModuleUnpacker 2022-05-31 00:58:44 +08:00
sunxyw
79f5011d58 fix adapter overflow 2022-05-31 00:52:15 +08:00
sunxyw
e350edd41f fix container example command not working 2022-05-31 00:51:53 +08:00
sunxyw
23a6e56478 fix logger constructor 2022-05-31 00:51:26 +08:00
sunxyw
80050f11f2 increment build number (build 607) 2022-05-28 09:33:44 +00:00
sunxyw
25c46cc978 update api docs 2022-05-28 09:33:43 +00:00
sunxyw
458c42ae7c optimize container services register (#129)
* optimize container services register

* fix ConnectionObject not exists

* fix phpdoc
2022-05-28 17:33:01 +08:00
sunxyw
febeeadc7b increment build number (build 606) 2022-05-24 06:37:35 +00:00
sunxyw
044643559d Merge pull request #131 from zhamao-robot/refactor-framework-entry
轻量重构 Framework 类
2022-05-24 14:36:35 +08:00
sunxyw
782e668abf improve remote terminal logging 2022-05-23 11:54:07 +08:00
sunxyw
fa6af88566 fix dynamic logger call 2022-05-23 11:52:02 +08:00
sunxyw
c106c4fc2a cleanup framework class logging 2022-05-23 11:52:01 +08:00
sunxyw
09780f64de refactor framework class logging 2022-05-23 11:52:01 +08:00
sunxyw
81d4558b2f add master support for logger 2022-05-23 11:52:01 +08:00
sunxyw
3de0e37fd5 increment build number (build 605) 2022-05-23 01:52:21 +00:00
sunxyw
fcfd2f8ba5 update api docs 2022-05-23 01:52:19 +00:00
sunxyw
7e7e461237 remove deprecated global functions (#130) 2022-05-23 09:51:26 +08:00
sunxyw
2afab030bd increment build number (build 604) 2022-05-16 15:28:58 +00:00
sunxyw
5cbeee6e86 add logging config (#127) 2022-05-16 23:28:02 +08:00
sunxyw
87bbffefc3 increment build number (build 603) 2022-05-15 17:53:12 +00:00
sunxyw
a2877cab70 Merge pull request #126 from zhamao-robot/add-phpstan-extensions
添加 PHPStan 相关扩展
2022-05-16 01:52:30 +08:00
sunxyw
4f10b6dbc3 fix use of deprecated methods 2022-05-15 16:40:12 +08:00
sunxyw
24a213a8ff drop use of deprecated DBAL iterator 2022-05-15 16:39:26 +08:00
sunxyw
cf21044cf7 add phpunit extensions 2022-05-15 16:38:37 +08:00
crazywhalecc
289a5d7051 increment build number (build 602) 2022-05-14 17:17:29 +00:00
crazywhalecc
b5ae76d298 update api docs 2022-05-14 17:17:27 +00:00
Jerry Ma
598cf60e10 Merge pull request #125 from zhamao-robot/v3-refactor-command
框架V3部分重构
2022-05-15 01:16:39 +08:00
crazywhalecc
c4ca2103e4 fix phpunit-swoole class name 2022-05-15 00:16:01 +08:00
crazywhalecc
4b55a3e525 add $ZM_CUSTOM_PHP_PATH env support 2022-05-14 23:52:37 +08:00
crazywhalecc
376b81f841 change another table printer 2022-05-14 23:51:47 +08:00
crazywhalecc
ee6035c59a add openswoole support 2022-05-14 23:51:17 +08:00
crazywhalecc
a757330788 move process state related function to ProcessManager 2022-05-14 23:43:15 +08:00
crazywhalecc
bf141202f8 change worker start message 2022-05-14 23:42:15 +08:00
crazywhalecc
1be3127177 use zhamao/logger table printer instead 2022-05-14 23:41:24 +08:00
crazywhalecc
c74a43cd74 remove and refactor daemon/server command, add useful messages 2022-05-14 23:40:22 +08:00
crazywhalecc
1b520d3c96 add zhamao/logger dependency 2022-05-14 23:20:58 +08:00
sunxyw
b7418a2a3a fix increment build number wrong branch 2022-05-10 17:55:06 +08:00
Jerry Ma
eee67cdb53 Merge pull request #124 from zhamao-robot/refactor-zmconfig
重构 ZMConfig
2022-05-10 17:04:20 +08:00
crazywhalecc
1d70bc4ed7 change risky test 2022-05-10 16:03:37 +08:00
crazywhalecc
d06b0dd6d6 change include_once to require 2022-05-10 14:53:23 +08:00
crazywhalecc
cbbac0554e fix Console debug for ZMConfig get 2022-05-10 01:04:18 +08:00
crazywhalecc
5f16766997 update errcode docs 2022-05-10 00:32:42 +08:00
crazywhalecc
dcd6cae0f6 add global function is_assoc_array 2022-05-10 00:32:20 +08:00
crazywhalecc
cc43993d5b MessageUtilTest use smaller image to boost 2022-05-10 00:31:40 +08:00
crazywhalecc
2478ffe331 fix WorkerStop read global config bug 2022-05-10 00:31:03 +08:00
crazywhalecc
18ae960f86 refactor ZMConfig 2022-05-10 00:30:33 +08:00
sunxyw
fcb226e357 increment build number (build 601) 2022-05-09 16:53:51 +08:00
sunxyw
58c04b7a7b fix incorrect build branch 2022-05-09 16:42:34 +08:00
sunxyw
a6401fa9ef add adapter feature (#121) 2022-05-09 16:39:09 +08:00
sunxyw
2481124ada update workflows for future develop (#123)
* update workflows for future develop

* fix updated build id path
2022-05-09 16:36:32 +08:00
crazywhalecc
488fde47e5 create 3.x main branch and move VERSION constants 2022-05-08 21:15:16 +08:00
crazywhalecc
e7e77c99d0 update update docs 2022-05-07 17:54:16 +08:00
Github Build Bot
6fbd35ed33 increment build number (build 473) 2022-05-06 16:11:08 +00:00
Jerry Ma
fba2339280 Merge pull request #122 from zhamao-robot/command-enhancement
安装命令、操作命令强化
2022-05-07 00:10:26 +08:00
crazywhalecc
bd8270a4ae add script file auto-deploy action 2022-05-06 23:58:30 +08:00
crazywhalecc
5299061c87 change one-step installation method 2022-05-06 23:49:38 +08:00
crazywhalecc
e843aeac55 prevent server:stop command error when daemon file not exists 2022-05-06 23:36:29 +08:00
crazywhalecc
19c792209b add go.sh one-step installing script 2022-05-06 23:35:24 +08:00
crazywhalecc
277d442634 move all scripts to ext/ dir 2022-05-06 23:34:33 +08:00
Github Build Bot
51bec043e3 increment build number (build 472) 2022-05-06 13:09:23 +00:00
Github Build Bot
b7595f6f22 update api docs 2022-05-06 13:09:22 +00:00
sunxyw
55181d583f Merge pull request #120 from zhamao-robot/fix-container-object-inherit
修复容器静态属性及对象继承
2022-05-06 21:08:36 +08:00
sunxyw
b5a5a4f32e add container independence tests 2022-05-06 20:11:47 +08:00
sunxyw
a746779efa fix container object inherit 2022-05-06 19:55:45 +08:00
sunxyw
736b6ea0a5 add light cache tests (#119) 2022-05-05 22:32:51 +08:00
sunxyw
884f07baa6 add reflection util tests (#116) 2022-05-05 22:32:33 +08:00
sunxyw
b496c3136e add macroable test (#115) 2022-05-05 14:37:26 +08:00
Github Build Bot
bbfb40f973 increment build number (build 471) 2022-05-05 01:05:51 +00:00
Github Build Bot
a73e1fc164 update api docs 2022-05-05 01:05:50 +00:00
Jerry Ma
ef7acb7fa0 2.8 补充特性更新 #114 2022-05-05 09:05:05 +08:00
crazywhalecc
fcd108adbe cs-fix code 2022-05-04 23:28:21 +08:00
crazywhalecc
c9c76bfd10 refactor CQ 2022-05-04 23:24:55 +08:00
crazywhalecc
d9302a3120 remove redundant Console setlevel 2022-05-04 22:44:21 +08:00
crazywhalecc
0cb3308dd1 fix compatibility for PHP 8.1 2022-05-04 22:43:23 +08:00
crazywhalecc
583b9d7cf7 reset Console level in test 2022-05-04 22:30:56 +08:00
crazywhalecc
d7728ebc25 change test and PHPDoc 2022-05-04 22:25:42 +08:00
crazywhalecc
b6742526aa add Terminal related test 2022-05-04 21:31:38 +08:00
crazywhalecc
4defd8ac1b fix non-input environment bug #95 2022-05-04 21:31:10 +08:00
crazywhalecc
d28672e2ad add --audit-mode option 2022-05-04 21:14:56 +08:00
crazywhalecc
94d6a51358 fix EventMapIterator bug and add tests 2022-05-04 21:05:10 +08:00
crazywhalecc
54eabc948f fix instant mode related files 2022-05-04 21:03:59 +08:00
crazywhalecc
6c9e26ce83 fix bug #113 2022-05-04 17:53:49 +08:00
crazywhalecc
a934037179 prevent user from executing phar stub file directly 2022-05-04 17:43:15 +08:00
crazywhalecc
396444a089 add Windows and macOS installation tips 2022-05-04 17:42:07 +08:00
Github Build Bot
699444abdd increment build number (build 470) 2022-05-04 09:05:14 +00:00
Github Build Bot
088031f807 update api docs 2022-05-04 09:05:13 +00:00
sunxyw
8ce6e2c111 Merge pull request #110 from zhamao-robot/refactor-command-help-generator
重构 CommandHelpGenerator 至 CommandInfoUtil
2022-05-04 17:04:21 +08:00
sunxyw
e7f36b9fcf add CommandInfoUtil tests 2022-05-03 16:57:57 +08:00
sunxyw
dab91f526e fix command help format 2022-05-03 16:56:04 +08:00
sunxyw
35e23a7cbc simplify command help example 2022-05-03 16:13:13 +08:00
sunxyw
7df05df48f fix generate command list events not exists 2022-05-03 16:11:15 +08:00
sunxyw
707a1ae628 fix attribute php74 compatibility 2022-05-03 13:18:09 +08:00
sunxyw
a65fc4076b update MessageUtilTest 2022-05-03 13:09:58 +08:00
sunxyw
f487897cf2 add arguments list to command info util 2022-05-03 13:06:58 +08:00
sunxyw
869d9ed543 fix message util test 2022-05-03 13:06:58 +08:00
sunxyw
8f61ed7561 add jetbrains/phpstorm-attributes package 2022-05-03 13:06:57 +08:00
sunxyw
8cb6a32341 refactor CommandHelpGenerator to CommandInfoUtil 2022-05-03 13:06:55 +08:00
Github Build Bot
687260e53c increment build number (build 469) 2022-05-03 02:07:42 +00:00
Github Build Bot
a919ce4554 update api docs 2022-05-03 02:07:42 +00:00
Jerry Ma
d19d7acedd add @CommandArgument annotation
* add @CommandArgument and relevant event changes

* fix unknown bug

* remove relative constant for CommandArgument
2022-05-03 10:06:57 +08:00
sunxyw
a393b3aff5 fix phpunit printer (#112) 2022-05-02 17:02:39 +08:00
Github Build Bot
8c2036b6b4 increment build number (build 468) 2022-04-30 13:13:23 +00:00
Jerry Ma
dc081861ad Merge pull request #107 from zhamao-robot/optimize-phpunit
PHPUnit 及部分结构优化
2022-04-30 21:12:42 +08:00
crazywhalecc
ec76d2ba7d change @sunxyw email 2022-04-30 20:43:19 +08:00
Jerry Ma
47ce0a8e9c fix action runner stty issue for phpunit (#109) 2022-04-30 20:34:32 +08:00
Jerry Ma
f1c730962b Fix ZM_TEST_LOG_DEBUG bug, remove redundant code 2022-04-30 17:24:26 +08:00
crazywhalecc
d95a5131f6 remove ctx function throw exception 2022-04-30 13:38:15 +08:00
crazywhalecc
69637cf482 update composer.json, docs and tests 2022-04-30 13:36:40 +08:00
crazywhalecc
25d6ec3a92 private-mode output nothing 2022-04-30 13:35:45 +08:00
crazywhalecc
8bf5ff4e7f fix swoole exit error dumped 2022-04-30 13:34:48 +08:00
crazywhalecc
fd4e4be3a8 try to remove irrelevant information for phpunit 2022-04-30 13:33:38 +08:00
crazywhalecc
e0a01ea2ca simplify home command 2022-04-29 18:39:07 +08:00
sunxyw
256ccb96a6 increment build number (build 467) 2022-04-29 15:42:33 +08:00
sunxyw
bfffdc7d21 fix api docs generate breaks 2022-04-29 15:42:33 +08:00
sunxyw
3bbe21268b add auto response serialize for http request (#104)
* add auto response serialize for http request

* fix possible duplicate response end
2022-04-29 15:36:48 +08:00
sunxyw
1537e88a74 increment build number (build 466) 2022-04-29 12:36:23 +08:00
sunxyw
0d9711e62d fix build number cannot increment when api docs not modified 2022-04-29 12:35:02 +08:00
sunxyw
0a7c5f06c6 refactor RouteManager static file routing (#105) 2022-04-29 12:23:06 +08:00
sunxyw
e7a8a32b73 support container call with unnamed parameters (#103) 2022-04-29 12:22:34 +08:00
Github Build Bot
62b703f2e4 increment build number (build 464) 2022-04-28 13:51:33 +00:00
Github Build Bot
f44921d136 update api docs 2022-04-28 13:51:31 +00:00
sunxyw
cd42545c7d refactor match_pattern implementation (#102)
* refactor match_pattern implementation

* add match_pattern escaped wildcards support

* add match_pattern global function test
2022-04-28 21:50:48 +08:00
Github Build Bot
0df3fd7bed increment build number (build 463) 2022-04-15 16:00:58 +00:00
Github Build Bot
56241da281 update api docs 2022-04-15 16:00:57 +00:00
sunxyw
05a04104dd bump version to 2.8.0 (#100) 2022-04-15 23:59:59 +08:00
sunxyw
50d27ee186 add show-debug option to api docs generator 2022-04-15 23:43:21 +08:00
sunxyw
371926b5a6 improve api docs generator class discrimination 2022-04-15 23:37:54 +08:00
sunxyw
97face2406 add chain and stopwatch helper functions (#99)
* add chain helper function

* add stopwatch helper function
2022-04-15 23:10:29 +08:00
Github Build Bot
ea64b40011 increment build number (build 462) 2022-04-15 15:08:35 +00:00
Github Build Bot
6d23e489aa update api docs 2022-04-15 15:08:34 +00:00
sunxyw
f4d75e211f Merge pull request #97 from zhamao-robot/add-di
增加 IoC 容器 & 依赖注入支持
2022-04-15 23:07:52 +08:00
sunxyw
48f6cc644d abstract reflection utils 2022-04-12 17:52:51 +08:00
sunxyw
33f517333f fix unhandled exception 2022-04-12 17:13:17 +08:00
sunxyw
7253a309c7 refactor container injection 2022-04-11 23:42:00 +08:00
sunxyw
f2aff5882d use accurate property name 2022-04-11 23:39:42 +08:00
sunxyw
0dd61a7270 add di support for event handlers 2022-04-11 23:39:41 +08:00
sunxyw
420b8e6d67 add container debug log 2022-04-11 23:39:11 +08:00
sunxyw
9e08919ce0 fix read config before loaded 2022-04-11 23:39:11 +08:00
sunxyw
a7324f6c49 fix module config dir not exists 2022-04-11 23:39:10 +08:00
sunxyw
721c0834db inject container into framework 2022-04-11 23:39:10 +08:00
sunxyw
e37629aaea add container call test 2022-04-11 23:39:10 +08:00
sunxyw
a43a4a429e add reflection util 2022-04-11 23:39:09 +08:00
sunxyw
f5d34198e7 add container call method 2022-04-11 23:39:09 +08:00
sunxyw
46604293e9 remove unnecessary exceptions hint 2022-04-11 23:39:08 +08:00
sunxyw
58e405cccd Revert "add basic container usage example"
This reverts commit 86e379c6bd8eb829a947bce463ff68c9de2d4200.
2022-04-11 23:39:06 +08:00
sunxyw
1deea5bebc refactor container type hint 2022-04-11 23:38:29 +08:00
sunxyw
cad5636f92 add basic container usage example 2022-04-11 23:38:28 +08:00
sunxyw
90290bee94 add container generics type hint 2022-04-11 23:37:21 +08:00
sunxyw
9f7ebceeb9 add phpdoc to ZMBuf 2022-04-11 23:37:21 +08:00
sunxyw
60ea2c7e12 add container helper functions 2022-04-11 23:37:16 +08:00
sunxyw
441c866160 improve SingletonTrait compatibility 2022-04-11 23:35:36 +08:00
sunxyw
33d3341bb3 add request container 2022-04-11 23:35:36 +08:00
sunxyw
1d778fd78e add worker container 2022-04-11 23:35:36 +08:00
Github Build Bot
0cd73a6304 increment build number (build 461) 2022-04-11 14:03:48 +00:00
Github Build Bot
2fedfe5b18 update api docs 2022-04-11 14:03:47 +00:00
Jerry Ma
77c140bee6 Merge pull request #96 from zhamao-robot/qol-proxy
实现 ZMRobot 内置 AllBots & AllGroups 代理类
2022-04-11 22:03:06 +08:00
sunxyw
c06e38d71f add ZMRobot proxies usage example 2022-04-04 00:33:23 +08:00
sunxyw
9b59cec22a add all groups proxy for ZMRobot 2022-04-04 00:14:27 +08:00
sunxyw
306e992789 add all bots proxy for ZMRobot 2022-04-04 00:11:58 +08:00
sunxyw
8335cfed69 add implode_when_necessary global function 2022-04-04 00:10:42 +08:00
crazywhalecc
4702aa1987 update version docs 2022-04-03 21:47:02 +08:00
sunxyw
145e1b31a0 use https asset in vuepress component (#94) 2022-04-03 21:06:09 +08:00
Github Build Bot
f2e28de20c increment build number (build 460) 2022-04-02 18:25:07 +00:00
Github Build Bot
bcaaf88edb update api docs 2022-04-02 18:25:06 +00:00
Jerry Ma
120698fb43 Merge pull request #91 from zhamao-robot/phpstan-level-4
PHPStan Level 4
2022-04-03 02:24:27 +08:00
crazywhalecc
dd88585ffa local rebase for merging into master 2022-04-03 02:17:58 +08:00
crazywhalecc
93a8c450ad Fix MySQLWrapper related PHPDoc and variables 2022-04-03 02:17:58 +08:00
crazywhalecc
3451434997 strict to phpstan-level-4 2022-04-03 02:17:58 +08:00
Github Build Bot
0bab2e74b0 increment build number (build 459) 2022-04-02 17:31:49 +00:00
Github Build Bot
c1a877489b update api docs 2022-04-02 17:31:48 +00:00
crazywhalecc
520099aaba change description for return value in TaskManager 2022-04-03 01:31:04 +08:00
crazywhalecc
9bd02b3dd2 strict SignalListener param type 2022-04-03 01:31:04 +08:00
crazywhalecc
ba64f2c189 Fix typo 2022-04-03 01:31:04 +08:00
crazywhalecc
fbb194a6c5 Fix MySQLWrapper related PHPDoc and variables 2022-04-03 01:31:04 +08:00
crazywhalecc
30b2d2134b Fix MySQLWrapper related PHPDoc and variables 2022-04-03 01:31:04 +08:00
crazywhalecc
7eea71e282 Fix MySQLWrapper variable name 2022-04-03 01:31:04 +08:00
crazywhalecc
e40b3029e0 Fix context PHPDoc return type 2022-04-03 01:31:04 +08:00
crazywhalecc
17492c78fa Fix context PHPDoc return type 2022-04-03 01:31:04 +08:00
crazywhalecc
a9276d3f72 fix argument type error 2022-04-03 01:31:04 +08:00
crazywhalecc
eecbe49955 fix code to phpstan-level-2 2022-04-03 01:31:04 +08:00
sunxyw
be9874a9ad Merge pull request #89 from zhamao-robot/update-readme
更新 README Badges 及优化工作流触发路径
2022-04-02 22:32:38 +08:00
sunxyw
b4fcc057c5 update readme badge 2022-04-02 21:19:27 +08:00
sunxyw
d9499dc56b restrict workflows trigger path 2022-04-02 21:04:51 +08:00
sunxyw
f6806c88ab update readme badges 2022-04-02 20:58:32 +08:00
Github Build Bot
2caca545ad increment build number (build 458) 2022-04-02 11:37:16 +00:00
Github Build Bot
ff0f11da7f update api docs 2022-04-02 11:37:16 +00:00
crazywhalecc
daa1822bc5 fix the rest problem code to phpstan-level-1 2022-04-02 19:36:32 +08:00
crazywhalecc
d490892092 refactor module command to phpstan-level-1 2022-04-02 19:36:32 +08:00
sunxyw
182a4e7b06 Merge pull request #87 from zhamao-robot/doc-regenerate
API 文档重新生成并加入Workflow
2022-04-02 19:15:25 +08:00
crazywhalecc
e9beed03ea update docs 2022-04-02 19:06:52 +08:00
Jerry Ma
8351527aea add build id to auto-increment commit message 2022-04-02 18:45:17 +08:00
crazywhalecc
ddff663b0b update docs 2022-04-02 18:01:17 +08:00
sunxyw
31b4fb9201 fix api docs generate no dependencies 2022-04-02 17:37:00 +08:00
sunxyw
1f7f0da383 add generate api docs step to build workflow 2022-04-02 17:37:00 +08:00
crazywhalecc
9fa1079248 Re-generate API docs 2022-04-02 17:36:59 +08:00
Github Build Bot
ae0cf5e3d7 increment build number 2022-04-02 09:28:10 +00:00
Jerry Ma
672369c598 Merge pull request #86 from zhamao-robot/phpstan-level-2
PHPStan 升级到 level 2
2022-04-02 17:27:57 +08:00
Jerry Ma
73687f248b Merge branch 'master' into phpstan-level-2 2022-04-02 17:22:38 +08:00
crazywhalecc
65cc2a948a Update hooks 2022-04-02 17:07:24 +08:00
crazywhalecc
299f36dcc0 test --enable-openssl option for skipped 2022-04-02 02:45:24 +08:00
crazywhalecc
f5cbce5195 test --enable-openssl option 2022-04-02 02:18:31 +08:00
crazywhalecc
a3780667b2 change https to http 2022-04-02 02:13:08 +08:00
crazywhalecc
a21742a326 Enhancement for integration-test.yml
let commandline cs-fixer follow the configuration
2022-04-02 02:03:46 +08:00
sunxyw
40aacb2e61 refactor git hooks config 2022-04-01 19:32:55 +08:00
crazywhalecc
ba18869c85 fix cs 2022-04-01 19:25:25 +08:00
crazywhalecc
a454f2c523 change test to provider mode 2022-04-01 19:20:10 +08:00
crazywhalecc
7caebaa6ba Add CQ PHPUnit test 2022-03-31 02:25:03 +08:00
crazywhalecc
580abd7317 Fix partial code to level 2 2022-03-31 02:24:38 +08:00
crazywhalecc
3187431611 PHPStan: ignore Constant error bugs 2022-03-31 02:22:30 +08:00
crazywhalecc
81c37c9a0a Let command level follow phpstan.neon 2022-03-31 02:21:48 +08:00
Github Build Bot
ba5bca20da increment build number 2022-03-30 09:50:06 +00:00
sunxyw
533fe187bd fix cs 2022-03-30 17:49:53 +08:00
sunxyw
c4da26c19d remove the nasty catch 2022-03-30 17:49:53 +08:00
sunxyw
ca7bfcc8c6 fix php7.2 compatibility 2022-03-30 17:49:53 +08:00
sunxyw
6c7b582faf add http util test 2022-03-30 17:49:53 +08:00
sunxyw
6f2e6135f1 add singleton trait test 2022-03-30 17:49:53 +08:00
sunxyw
37a92e03c1 refactor generate command help test 2022-03-30 17:49:53 +08:00
sunxyw
35385f8916 adjust cs-fixer config 2022-03-30 17:49:53 +08:00
crazywhalecc
a2fbdd8e0a Enhancement for phpunit-swoole 2022-03-30 17:49:53 +08:00
crazywhalecc
bab610722f Add error exit code 2022-03-30 17:49:53 +08:00
crazywhalecc
4cabc8d132 Remove block line from script_setup_loader.php 2022-03-30 17:49:53 +08:00
crazywhalecc
e8bd381907 Add private-mode option for server command 2022-03-30 17:49:53 +08:00
crazywhalecc
42aac802dd Fix exclude-annotation-path not working bug 2022-03-30 17:49:53 +08:00
crazywhalecc
d748a20445 Update the test instance 2022-03-30 17:49:53 +08:00
crazywhalecc
5db3ff934d Fix pre-loaded events overwritten bug 2022-03-30 17:49:53 +08:00
crazywhalecc
9bfa3ede20 Fix isRelativePath() bug 2022-03-30 17:49:53 +08:00
crazywhalecc
127466e546 Fix DataProvider warning bug 2022-03-30 17:49:53 +08:00
crazywhalecc
16aa30cac7 Add tests to Annotation exclusion 2022-03-30 17:49:53 +08:00
sunxyw
05a3d0111b make phpunit run inside framework 2022-03-30 17:49:53 +08:00
sunxyw
9f4b5fb14a add data provider test 2022-03-30 17:49:53 +08:00
sunxyw
a716e68f87 add message util test 2022-03-30 17:49:53 +08:00
sunxyw
2e127771ed add test coverage config 2022-03-30 17:49:53 +08:00
sunxyw
c6bbba6051 remove old tests 2022-03-30 17:49:53 +08:00
Jerry Ma
443ed115b0 Merge pull request #83 from zhamao-robot/add-phpunit-framework
添加 PHPUnit 单元测试框架
2022-03-28 20:28:39 +08:00
sunxyw
f450b8d863 change phpunit default timezone to Asia/Shanghai 2022-03-28 18:19:48 +08:00
sunxyw
acf570e652 add .editorconfig to unify coding style 2022-03-28 18:18:59 +08:00
sunxyw
4e9199c68e refactor phpunit-swoole 2022-03-28 17:27:36 +08:00
sunxyw
6f5575b155 adjust phpunit config 2022-03-28 16:45:32 +08:00
sunxyw
700b854434 rename test folder 2022-03-28 16:42:13 +08:00
sunxyw
37b5d954e9 add phpunit config 2022-03-28 16:34:26 +08:00
sunxyw
ac50e96568 update .gitignore 2022-03-28 16:33:48 +08:00
sunxyw
86174c2e9f normalize composer 2022-03-28 16:09:16 +08:00
Jerry Ma
c1ae1dee06 Merge pull request #81 from zhamao-robot/add-auto-api-docs-generator
添加 API 文档生成器
2022-03-27 21:52:15 +08:00
Jerry Ma
c4aedf2958 Add gendoc to composer 2022-03-27 21:51:38 +08:00
Github Build Bot
736c8f2fc0 increment build number 2022-03-27 13:44:26 +00:00
Jerry Ma
294084299e Merge pull request #82 from zhamao-robot/bugfix/not-response
再次修复无法处理消息的 Bug
2022-03-27 21:44:10 +08:00
crazywhalecc
b1d30da4bc Re-fix the last no-message-response bug 2022-03-27 21:34:49 +08:00
sunxyw
506f2e7c0c add api docs generator 2022-03-27 19:19:05 +08:00
sunxyw
e13660dcdc add nav for api docs 2022-03-27 16:51:28 +08:00
sunxyw
4fbe2aa5af add api docs (#80) 2022-03-27 16:42:36 +08:00
507 changed files with 27016 additions and 14141 deletions

15
.editorconfig Normal file
View File

@@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

View File

@@ -1,30 +0,0 @@
name: Build
on:
pull_request:
branches:
- master
types:
- closed
paths:
- 'src/**.php'
jobs:
incremental-build-number:
if: github.event.pull_request.merged == true
name: Incremental Build Number
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Increment build number
run: sed -i -r 's/(.*)(\VERSION_ID\s=\s)([0-9]+)(.*)/echo "\1\2$((\3+1))\4"/ge' src/ZM/ConsoleApplication.php
- name: Commit change
run: |
git config --global user.name 'Github Build Bot'
git config --global user.email 'noreply@github.com'
git add src/ZM/ConsoleApplication.php
git commit -m "increment build number"
git push

42
.github/workflows/coding-style.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Code Style
on:
push:
pull_request:
workflow_dispatch:
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: same_content_newer
skip_after_successful_duplicate: true
paths: '["src/**", "tests/**"]'
do_not_skip: '["workflow_dispatch", "schedule"]'
cs-fix:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
name: Code Style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: sunxyw/workflows/setup-environment@main
with:
php-version: 8.0
php-extensions: swoole, posix, json
operating-system: ubuntu-latest
use-cache: true
- name: Code Style
uses: sunxyw/workflows/coding-style@main

View File

@@ -0,0 +1,54 @@
name: Increment Build Number
on:
pull_request:
branches:
- master
- '*-develop'
types:
- closed
paths:
- 'src/**.php'
jobs:
incremental-build-number:
if: github.event.pull_request.merged == true
name: Incremental Build Number
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Setup PHP
uses: sunxyw/workflows/setup-environment@main
with:
php-version: 8.0
php-extensions: swoole, posix, json
operating-system: ubuntu-latest
use-cache: true
- name: Generate API Docs
id: generate-api-docs
continue-on-error: true
run: bin/gendoc
- name: Commit API Docs
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: update api docs
branch: ${{ github.base_ref }}
- name: Increment build number
id: increment-build-number
run: |
sed -i -r 's/(.*)(\VERSION_ID\s=\s)([0-9]+)(.*)/echo "\1\2$((\3+1))\4"/ge' src/ZM/Framework.php
BUILD_ID=$(cat src/ZM/Framework.php | grep "VERSION_ID = " | sed 's/[^0-9]//g')
echo "::set-output name=build_id::$BUILD_ID"
- name: Commit build number
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: increment build number (build ${{ steps.increment-build-number.outputs.build_id }})
branch: ${{ github.base_ref }}

View File

@@ -1,65 +0,0 @@
name: Integration Test
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- 'docs/**'
pull_request:
branches:
- master
types:
- opened
- synchronize
- reopened
- ready_for_review
- review_requested
paths-ignore:
- '**.md'
- 'docs/**'
jobs:
integration:
name: Integration Test (PHP ${{ matrix.php-versions }}) (OS ${{ matrix.operating-system }})
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ "ubuntu-latest", "macos-latest" ]
php-versions: [ "7.2", "7.3", "7.4", "8.0", "8.1" ]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: ${{ matrix.php-versions }}
extensions: swoole, posix, json
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Validate composer.json
run: "composer validate --strict"
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer Dependencies
run: "composer install --prefer-dist --no-progress --optimize-autoloader"
- name: Run Static Analysis
run: "composer analyse"
- name: Run PHP CS Fixer Check
run: "./vendor/bin/php-cs-fixer fix --dry-run --diff"

42
.github/workflows/static-analysis.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Static Analysis
on:
push:
pull_request:
workflow_dispatch:
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: same_content_newer
skip_after_successful_duplicate: true
paths: '["src/**", "tests/**"]'
do_not_skip: '["workflow_dispatch", "schedule"]'
analyse:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
name: Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: sunxyw/workflows/setup-environment@main
with:
php-version: 8.0
php-extensions: swoole, posix, json
operating-system: ubuntu-latest
use-cache: true
- name: Static Analysis
uses: sunxyw/workflows/static-analysis@main

54
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: Test
on:
push:
branches:
- main
- develop
- '*-dev*'
pull_request:
types:
- opened
- reopened
- review_requested
workflow_dispatch:
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: same_content_newer
skip_after_successful_duplicate: true
paths: '["src/**", "tests/**", "bin/phpunit-zm"]'
do_not_skip: '["workflow_dispatch", "schedule"]'
test:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
strategy:
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
php-version: [ 8.0, 8.1, 8.2 ]
name: PHP ${{ matrix.php-version }} Test (${{ matrix.operating-system }})
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: sunxyw/workflows/setup-environment@main
with:
php-version: ${{ matrix.php-version }}
php-extensions: swoole, posix, json
operating-system: ${{ matrix.operating-system }}
use-cache: true
- name: Test
uses: sunxyw/workflows/test@main

View File

@@ -1,8 +1,11 @@
name: VuePress Auto Deploy
name: Docs and Script Auto Deploy
on:
push:
branches:
- master
paths:
- 'docs/**'
- 'ext/**'
jobs:
build:
@@ -10,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Deploy docs to GitHub Pages
uses: jenkey2011/vuepress-deploy@master
@@ -30,3 +33,11 @@ jobs:
REMOTE_HOST: ${{ secrets.ZHAMAO_XIN_HOST }}
REMOTE_USER: ${{ secrets.ZHAMAO_XIN_USER }}
TARGET: ${{ secrets.ZHAMAO_XIN_TARGET }}
- name: deploy script file
uses: wlixcc/SFTP-Deploy-Action@v1.2
with:
username: ${{ secrets.ZHAMAO_XIN_USER }}
server: ${{ secrets.ZHAMAO_XIN_HOST }}
ssh_private_key: ${{ secrets.ZHAMAO_XIN_PRIVATE_KEY }}
local_path: './ext/go.sh'
remote_path: ${{ secrets.ZHAMAO_XIN_MAIN_TARGET }}

75
.gitignore vendored
View File

@@ -1,21 +1,27 @@
.idea/
/src/test/
/src/webconsole/config/
/vendor/
### Zhamao Framework ###
/zm_data/
composer.lock
/resources/server.phar
/distribute/
/bin/.phpunit.result.cache
/resources/zhamao.service
.phpunit.result.cache
.daemon_pid
/runtime/
/tmp/
/temp/
/site/
/plugins/
# go-cqhttp快速安装启动相关可能被废弃
# 框架审计文件
audit.log
# 进程锁文件
.daemon_pid
.zm_worker_*.pid
### Composer ###
composer.phar
/vendor/
composer.lock
### Go CQHTTP ###
/ext/go-cqhttp/data/
/ext/go-cqhttp/logs/
/ext/go-cqhttp/config.hjson
@@ -23,12 +29,55 @@ composer.lock
/ext/go-cqhttp/go-cqhttp
/ext/go-cqhttp/session.token
.zm_worker_*.pid
### Git ###
# 备份文件
*.orig
# Git Hook 的相关锁文件
# 解决 Merge 冲突时可能会自动生成的文件
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
# Git Hooks
cghooks.lock
# Vuepress 相关文件
### VuePress ###
/node_modules/
/docs/.vuepress/dist/
package-lock.json
package-lock.json
### PHPUnit ###
# 生成的文件
/bin/.phpunit.result.cache
.phpunit.result.cache
.phpunit.cache
# 本地配置
/phpunit.xml
# 构建目录
/build/
### PhpStorm ###
# 兼容 PHPStorm 及其他 Jetbrains IDE
# 除了代码格式配置和运行配置之外的所有文件
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Phive ###
/.phive/
/tools/
### ASDF ###
/.tool-version
.DS_Store

View File

@@ -65,11 +65,11 @@ return (new PhpCsFixer\Config())
'standardize_not_equals' => true,
'multiline_comment_opening_closing' => true,
'phpdoc_summary' => false,
'php_unit_test_class_requires_covers' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('docs')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
)
->setUsingCache(false);

11
.phpstorm.meta.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
namespace PHPSTORM_META {
use OneBot\V12\Object\Event\OneBotEvent;
use ZM\Context\Context;
override(Context::__call(0), map([
'getBotEvent' => OneBotEvent::class,
]));
}

View File

@@ -1,17 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Reload Zhamao Server" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="./zhamao server:reload &amp;&amp; exit" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@@ -1,17 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Zhamao Server" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="./zhamao server" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="./zhamao" />
<option name="SCRIPT_OPTIONS" value="server" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@@ -1,17 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run watcher" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="bin/watcher" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/zsh" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@@ -1,17 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Stop Zhamao Server" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="./zhamao server:stop &amp;&amp; exit" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

68
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,68 @@
# 炸毛框架贡献指南
首先很高兴你愿意读这篇文章,因为我们需要更多的开发者来帮助我们开发和维护。
如果你还没加入我们的 [QQ 群670821194][qq-group],我们建议你加入一下,以便和其他开发者实时交流和协作。
## 测试
我们目前采用 PHPUnit 作为测试框架,如果你编写了新的功能或改变了现有的行为,我们希望你可以编写相应的测试代码。
## 提交变更
请使用 [GitHub Pull Request][new-pr] 提交你的更改,并附上恰当的说明(例如一个简明的列表列出所作的改动)。
同时,请不要忘记在提交前执行代码格式检查 `composer cs-fix` 和静态分析检查 `composer analyse`
。虽然我们的自动化流程会在你推送到仓库后自动运行检查,但我仍然建议你提前在本地运行,以节省可能的修改成本。
对了,请尽量为你的每个函数、方法加上 PHPDoc 注释。
## 具体贡献流程
#### **你发现了个 BUG**
- **如果你发现的是安全漏洞,请不要在 GitHub 上回报!** 请直接联系 [@crazywhalecc](https://github.com/crazywhalecc)。
- **确保该问题还没被其他人回报。** 你可以在 [Issue 列表][issues] 中搜索相关关键词来检查。
- 如果你没能找到一个已有的 Issue 来描述你遇到的问题,[请新建一个 Issue][new-issue]。请务必包含**标题和清晰的描述**
,尽可能多的相关信息,以及一个**代码示例**或者一个**可执行的测试用例**,来描述你遇到的问题。
- 如果可以的话,请使用相关的 Issue 模板来创建 Issue。
#### **你修复了个 BUG**
- 在 GitHub 上提交一个 Pull Request。
- 确保 PR 的描述清楚地描述了问题和解决方案。如果有相关的 Issue请在 PR 描述中包含 Issue 编号。
#### **你想添加新功能或改变现有功能?**
- 虽然你可以直接提交 PR但我们建议你先与我们的开发者讨论你的想法以避免你的努力白费。你可以在 [QQ 群][qq-group]
中与我们的开发者交流,或者在 [GitHub Issue][issues] 中提出你的想法。
- 如果你的想法被采纳,你可以在 GitHub 上[提交一个 Pull Request][new-pr]。
#### **你对源码有疑问?**
- 你可以在 [QQ 群][qq-group] 中与我们的开发者讨论,或者你也可以在 [GitHub Issue][issues] 中提出你的疑问。
#### **你想为文档做贡献?**
- 非常欢迎^^
- 你可以直接[提交一个 Pull Request][new-pr]。
炸毛框架是由志愿开发者共同维护的项目。我们欢迎你加入我们的开发。
感谢~ :heart: :heart: :heart:
炸毛框架开发团队
[issues]: https://github.com/zhamao-robot/zhamao-framework/issues
[new-pr]: https://github.com/zhamao-robot/zhamao-framework/pull/new/master
[new-issue]: https://github.com/zhamao-robot/zhamao-framework/issues/new
[qq-group]: https://jq.qq.com/?_wv=1027&k=KdIGy0UK

View File

@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2022 CrazyBot Developer Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

110
README.md
View File

@@ -3,14 +3,42 @@
<h2>炸毛框架</h2>
炸毛框架 (zhamao-framework) 是一个协程高性能的聊天机器人 + Web 服务器开发框架<br><br>
[![作者QQ](https://img.shields.io/badge/作者QQ-627577391-orange.svg)](http://wpa.qq.com/msgrd?v=3&uin=627577391&site=qq&menu=yes)
[![zhamao License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/zhamao-robot/zhamao-framework/blob/master/LICENSE)
[![Latest Stable Version](http://img.shields.io/packagist/v/zhamao/framework.svg)](https://packagist.org/packages/zhamao/framework)
[![Banner](https://img.shields.io/badge/OneBot-v11-success)](https://github.com/howmanybots/onebot)
![Integration Test](https://github.com/zhamao-robot/zhamao-framework/actions/workflows/integration-test.yml/badge.svg)
<p align="center">
<a href="https://onebot.dev/">
<img src="https://img.shields.io/badge/OneBot-11-black?style=flat-square" alt="OneBot">
</a>
[![注解数量](https://img.shields.io/github/search/zhamao-robot/zhamao-framework/AnnotationBase.svg)](https://github.com/zhamao-robot/zhamao-framework/search?q=AnnotationBase)
[![TODO 数量](https://img.shields.io/github/search/zhamao-robot/zhamao-framework/TODO.svg)](https://github.com/zhamao-robot/zhamao-framework/search?q=TODO)
<a href="https://github.com/zhamao-robot/zhamao-framework/actions">
<img src="https://img.shields.io/github/actions/workflow/status/zhamao-robot/zhamao-framework/test.yml?branch=v3-develop&label=Test&style=flat-square" alt="Integration Test">
</a>
<a href="https://packagist.org/packages/zhamao/framework">
<img src="https://img.shields.io/packagist/dt/zhamao/framework?label=Downloads&style=flat-square" alt="下载数">
</a>
<a href="https://github.com/zhamao-robot/zhamao-framework/releases">
<img src="https://img.shields.io/packagist/v/zhamao/framework?include_prereleases&label=Release&style=flat-square" alt="最新版本">
</a>
<a href="https://github.com/zhamao-robot/zhamao-framework/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/zhamao-robot/zhamao-framework?label=License&style=flat-square" alt="开源协议">
</a>
<a href="https://wpa.qq.com/msgrd?v=3&uin=627577391&site=qq&menu=yes">
<img src="https://img.shields.io/badge/作者QQ-627577391-orange?style=flat-square" alt="作者QQ">
</a>
<br>
<br>
<a href="https://github.com/zhamao-robot/zhamao-framework/search?q=AnnotationBase">
<img src="https://img.shields.io/github/search/zhamao-robot/zhamao-framework/AnnotationBase?label=Annotations&style=flat-square" alt="注解数量">
</a>
<a href="https://github.com/zhamao-robot/zhamao-framework/search?q=TODO">
<img src="https://img.shields.io/github/search/zhamao-robot/zhamao-framework/TODO?label=TODO&style=flat-square" alt="TODO">
</a>
</p>
</div>
@@ -22,42 +50,50 @@
## 简介
炸毛框架使用 PHP 编写,采用 Swoole 扩展为基础,主要面向 API 服务,聊天机器人OneBot 兼容的 QQ 机器人对接),包含 Websocket、HTTP
炸毛框架使用 PHP 编写,主要面向 API 服务,聊天机器人,包含 Websocket、HTTP
等监听和请求库,用户代码采用模块化处理,使用注解可以方便地编写各类功能。
框架主要用途为 HTTP 服务器,机器人搭建框架。尤其对于 QQ 机器人消息处理较为方便和全面,提供了众多会话机制和内部调用机制,可以以各种方式设计你自己的模块
框架主要用途为 HTTP 服务器,机器人搭建框架。尤其对于聊天机器人消息处理较为方便和全面,提供了众多会话机制和内部调用机制,可以以各种方式设计你自己的插件
```php
/**
* @CQCommand("你好")
*/
#[\BotCommand('你好')]
public function hello() {
ctx()->reply("你好,我是炸毛!"); // 简单的命令式回复
}
/**
* @RequestMapping("/index")
*/
#[\Route('/index')]
public function index() {
return "<h1>hello!</h1>"; // 快速的 HTTP 服务开发
}
```
> 从 2.7.0 版本开始,框架已支持同时使用 Annotation 和原生 Attribute 注解,供开发者根据需要自由选用。
## 开始
如果你是初学者,可以直接使用以下脚本部署 PHP 环境和安装框架的脚手架:
框架目前支持 Linux、WSL、macOS 环境直接运行,上述环境可直接使用下方一键安装脚本。
> 如果你想在其他环境安装部署,可使用 Docker、Cygwin详见文档。
```bash
# 新建一个自己喜欢名字的文件夹,运行一键安装脚本 (仅限 x86-64(AMD64) 和 AArch64(ARM64) 平台)
mkdir zhamao-app/
cd zhamao-app/
# 默认安装的 PHP 版本为 7.4,如需使用其他版本,请设置环境变量 ZM_DOWN_PHP_VERSION 为对应的 PHP 版本,例如:
# export ZM_DOWN_PHP_VERSION=8.1
bash -c "$(curl -fsSL https://api.zhamao.xin/go.sh)"
# 检测PHP环境、安装框架
bash <(curl -fsSL https://zhamao.xin/go.sh)
# 启动
./zhamao server:start
# 启动框架
cd zhamao-app
./zhamao server
```
一键安装脚本还有可以自定义参数的方式,比如:
```bash
# 脚本默认会检测系统的PHP如果想直接跳过检测安装独立的PHP版本则添加此环境变量
export ZM_NO_LOCAL_PHP="yes"
# 脚本如果安装独立版本PHP默认版本为8.0,如果想使用其他版本,则添加此环境变量指定版本
export ZM_DOWN_PHP_VERSION="8.1"
# 脚本默认会将框架在当前目录下的 `zhamao-app` 目录进行安装,如果想使用其他目录,则添加此环境变量
export ZM_CUSTOM_DIR="my-custom-app"
# 脚本默认会对本项目使用阿里云国内加速镜像如果想使用packagist源则添加此环境变量
export ZM_COMPOSER_PACKAGIST="yes"
# 执行完前面的环境变量再执行一键安装脚本,就可以实现自定义参数!
bash <(curl -fsSL https://zhamao.xin/go.sh)
```
关于其他安装方式,请参阅[文档](https://framework.zhamao.xin/guide/installation.html) 。
@@ -71,22 +107,20 @@ bash -c "$(curl -fsSL https://api.zhamao.xin/go.sh)"
## 特点
- 原生支持多个机器人客户端同时连接
- 使用 Swoole 多工作进程机制和协程加持,尽可能简单的情况下提升了性能
- 灵活的注解事件绑定机制,可同时使用 Annotation 和原生 Attribute 注解
- 易用的上下文,模块内随处可
- 采用模块化编写,可自由搭配其他 Composer 组件,也可单文件面向过程编写
- 完善的插件系统,可编写插件后打包或分发,供他人使
- 采用插件化编写,可自由搭配其他 Composer 组件,也可单文件面向过程编写
- 支持模块打包、热加载,分享模块更方便
- 常驻内存,全局缓存变量随处使用,提供多种缓存方案
- 自带 MySQL、Redis 等数据库连接池等数据库连接方案
- 自带 MySQL、SQLite、Redis 等数据库连接池
- 本身为 HTTP 服务器、WebSocket 服务器,可以构建属于自己的 HTTP API 接口
- 静态文件服务器,可将前端合并到一起
- 自带 PHP + Swoole 环境无需手动编译安装by [crazywhalecc/static-php-cli](https://github.com/crazywhalecc/static-php-cli)
- 自带 PHP 环境无需手动编译安装by [crazywhalecc/static-php-cli](https://github.com/crazywhalecc/static-php-cli)
## 下载源码
框架源码可直接克隆本仓库进行编辑,如果你在国内,访问 GitHub 和克隆仓库比较慢,可以将 `github.com` 替换为 `fgit.zhamao.me` 进行加速。
例如:`git clone https://fgit.zhamao.me/zhamao-robot/zhamao-framework.git --depth 1`
例如:`git clone https://hub.fastgit.xyz/zhamao-robot/zhamao-framework.git --depth 1`
## 贡献和捐赠
@@ -110,12 +144,12 @@ bash -c "$(curl -fsSL https://api.zhamao.xin/go.sh)"
作者的炸毛机器人已从2018年初起稳定运行了**四年半**,并且持续迭代。
欢迎随时在 HTTP-API 插件群里提问,当然更好的话可以加作者 QQ[627577391](http://wpa.qq.com/msgrd?v=3&uin=627577391&site=qq&menu=yes)
可以加作者 QQ[627577391](http://wpa.qq.com/msgrd?v=3&uin=627577391&site=qq&menu=yes)
或提交 [Issue](https://github.com/zhamao-robot/zhamao-framework/issues/new/choose) 进行疑难解答。
本项目在更新内容时,请及时关注 GitHub 动态,更新前请将自己的模块代码做好备份。
本项目在更新内容时,请及时关注 GitHub 动态,更新前请将自己的插件或项目代码做好备份。
项目框架采用 Apache-2.0 协议开源,在分发或重写修改等操作时需遵守协议。项目模块部分(`Module` 文件夹) 在非借鉴框架内代码时可不遵守 Apache-2.0 协议进行分发和修改(声明版权)。
项目框架采用 Apache-2.0 协议开源,在分发或重写修改等操作时需遵守协议。项目插件部分(`src/Globals``src/ZM` 文件夹外的其他文件夹) 在非借鉴框架内代码时可不遵守 Apache-2.0 协议进行分发和修改(声明版权)。
**注意**:在你使用 mirai 等 `AGPL-3.0` 协议的机器人软件与框架连接时,使用本框架需要将你编写或修改的部分使用 `AGPL-3.0` 协议重新分发。
@@ -125,6 +159,6 @@ bash -c "$(curl -fsSL https://api.zhamao.xin/go.sh)"
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/PhpStorm.svg" width="300">
感谢 [php-libonebot](https://github.com/botuniverse/php-libonebot) 开发者 @sunxyw 中为项目开发规范化提出的一些建议。
感谢开发者 @sunxyw 中为项目开发规范化提出的一些建议。
<!-- ![star](https://starchart.cc/zhamao-robot/zhamao-framework.svg) -->
![star](https://starchart.cc/zhamao-robot/zhamao-framework.svg)

409
bin/gendoc Executable file
View File

@@ -0,0 +1,409 @@
#!/usr/bin/env php
<?php
/**
* 决定是否忽略该类
*
* @param ReflectionClass $class 准备生成的类的反射类
*/
function should_ignore_class(ReflectionClass $class): bool
{
// 注解类
if (($doc = $class->getDocComment()) && strpos($doc, '@Annotation') !== false) {
return true;
}
if (str_ends_with($class->getName(), 'Exception')) {
return true;
}
if (str_contains($class->getName(), '_')) {
return true;
}
return false;
}
if (PHP_VERSION_ID < 70400) {
echo 'PHP 版本必须为 7.4 或以上';
exit(1);
}
function check_composer_executable(string $composer): bool
{
passthru($composer . ' --version 2>/dev/null', $exit_code);
return $exit_code === 0;
}
function find_valid_root(string $current_dir, int $max_loop): string
{
if ($max_loop <= 0) {
return '';
}
if (!file_exists($current_dir . '/composer.json')) {
return find_valid_root(dirname($current_dir), $max_loop - 1);
}
return $current_dir;
}
$root = find_valid_root(getcwd(), 3);
if (empty($root)) {
echo '找不到有效的根目录';
exit(1);
}
echo '根目录: ' . $root . PHP_EOL;
chdir($root);
if (!is_dir($root . '/src/ZM')) {
echo '源码目录不存在';
exit(1);
}
$phpdoc_package_temp_installed = false;
if (file_exists($root . '/vendor/jasny/phpdoc-parser/composer.json')) {
echo '正在使用现有的 PHPDoc 解析库' . PHP_EOL;
} else {
echo 'PHPDoc 解析库不存在,正在尝试安装...' . PHP_EOL;
echo '本次生成完成后将会自动移除' . PHP_EOL;
$composers = [
'runtime/composer', 'composer', 'php composer.phar',
];
foreach ($composers as $composer) {
if (check_composer_executable($composer)) {
echo '正在使用 ' . $composer . ' 安装 PHPDoc 解析库,请稍候...' . PHP_EOL;
passthru("{$composer} require --quiet jasny/phpdoc-parser", $exit_code);
if ($exit_code === 0) {
$phpdoc_package_temp_installed = true;
break;
}
}
}
if (!$phpdoc_package_temp_installed) {
echo '安装失败请手动安装composer require jasny/phpdoc-parser' . PHP_EOL;
exit(1);
}
}
function remove_temp_phpdoc_package()
{
if ($GLOBALS['phpdoc_package_temp_installed']) {
echo '正在移除 PHPDoc 解析库,请稍候...' . PHP_EOL;
passthru('composer remove --quiet jasny/phpdoc-parser', $exit_code);
if ($exit_code !== 0) {
echo '移除失败请手动移除composer remove jasny/phpdoc-parser' . PHP_EOL;
}
echo '移除完成';
}
}
register_shutdown_function('remove_temp_phpdoc_package');
// 从这里开始是主要生成逻辑
require_once $root . '/vendor/autoload.php';
use Jasny\PhpdocParser\PhpdocParser;
use Jasny\PhpdocParser\Set\PhpDocumentor;
use Jasny\PhpdocParser\Tag\Summery;
use ZM\Logger\ConsoleLogger;
$opts = getopt('', ['show-warnings', 'show-debug']);
if (array_key_exists('show-warnings', $opts)) {
$show_warnings = true;
} else {
$show_warnings = false;
}
ob_logger_register(new ConsoleLogger(array_key_exists('show-debug', $opts) ? 'debug' : 'info'));
$errors = [];
$warnings = [];
// 获取源码目录的文件遍历器
$fs = new \RecursiveDirectoryIterator($root . '/src/ZM', FilesystemIterator::SKIP_DOTS);
// 初始化文档解析器
$parser = new PhpdocParser(PhpDocumentor::tags()->with([
new Summery(),
]));
$metas = [];
$class_count = 0;
$method_count = 0;
function error(string $message)
{
global $errors;
$errors[] = $message;
logger()->error($message);
}
function warning(string $message)
{
global $warnings, $show_warnings;
$warnings[] = $message;
if ($show_warnings) {
logger()->warning($message);
}
}
/**
* 获取类的元数据
*
* 包括类的注释、方法的注释、参数、返回值等
*/
function get_class_metas(string $class_name, PhpdocParser $parser): array
{
// 尝试获取反射类
try {
$class = new \ReflectionClass($class_name);
} catch (\ReflectionException $e) {
error('无法获取类 ' . $class_name . ' 的反射类');
return [];
}
// 判断是否略过该类
if (should_ignore_class($class)) {
return [];
}
$metas = [];
// 遍历类方法
foreach ($class->getMethods() as $method) {
if ($method->getDeclaringClass()->getName() !== $class_name) {
continue;
}
logger()->debug('正在解析方法:' . $class_name . '::' . $method->getName());
// 获取方法的注释并解析
$doc = $method->getDocComment();
if (!$doc) {
warning('找不到文档:' . $class_name . '::' . $method->getName());
continue;
}
try {
// 解析器对于多余空格的解析似乎有问题,这里去除一下多余的空格
$doc = preg_replace('/\s(?=\s)/', '\\1', $doc);
$meta = $parser->parse($doc);
} catch (\Exception $e) {
error('解析失败:' . $class_name . '::' . $method->getName() . '' . $e->getMessage());
continue;
}
// 少数情况解析后会带有 */,需要去除
array_walk_recursive($meta, static function (&$item) {
if (is_string($item)) {
$item = trim(str_replace('*/', '', $item));
}
});
// 对比反射方法获取的参数和注释声明的参数
$parameters = $method->getParameters();
$params_in_doc = $meta['params'] ?? [];
foreach ($parameters as $parameter) {
$parameter_name = $parameter->getName();
// 不存在则添加进参数列表中
if (!isset($params_in_doc[$parameter_name])) {
$params_in_doc[$parameter_name] = [
'type' => $parameter->getType()?->getName(),
'description' => '',
];
}
}
// 确保所有参数都有对应的类型和描述
foreach ($params_in_doc as &$param) {
if (!isset($param['type'])) {
$param['type'] = 'mixed';
}
if (!isset($param['description'])) {
$param['description'] = '';
}
}
// 清除引用
unset($param);
$meta['params'] = $params_in_doc;
// 设定方法默认返回值
if (!isset($meta['return'])) {
$meta['return'] = [
'type' => $method->getReturnType()?->getName() ?: 'mixed',
'description' => '',
];
}
// 设定默认描述
if (!isset($meta['return']['description'])) {
$meta['return']['description'] = '';
}
$metas[$method->getName()] = $meta;
}
return $metas;
}
/**
* 将方法的元数据转换为 Markdown 格式
*
* @param string $method 方法名
* @param array $meta 元数据
*/
function convert_meta_to_markdown(string $method, array $meta): string
{
// 方法名作为标题
$markdown = '## ' . $method . "\n\n";
// 构造方法代码块
$markdown .= '```php' . "\n";
// TODO: 适配 private 等修饰符
$markdown .= 'public function ' . $method . '(';
$params = [];
// 添加参数
foreach ($meta['params'] as $param_name => $param_meta) {
$params[] = sprintf('%s $%s', $param_meta['type'] ?? 'mixed', $param_name);
}
$markdown .= implode(', ', $params) . ')';
// 添加返回值
$markdown .= ': ' . $meta['return']['type'];
$markdown .= "\n```\n\n";
// 方法描述
$markdown .= '### 描述' . "\n\n";
$markdown .= ($meta['description'] ?? '作者很懒,什么也没有说') . "\n\n";
// 参数
if (count($meta['params'])) {
$markdown .= '### 参数' . "\n\n";
$markdown .= '| 名称 | 类型 | 描述 |' . "\n";
$markdown .= '| -------- | ---- | ----------- |' . "\n";
foreach ($meta['params'] as $param_name => $param_meta) {
$markdown .= '| ' . $param_name . ' | ' . $param_meta['type'] . ' | ' . $param_meta['description'] . ' |' . "\n";
}
$markdown .= "\n";
}
// 返回值
$markdown .= '### 返回' . "\n\n";
$markdown .= '| 类型 | 描述 |' . "\n";
$markdown .= '| ---- | ----------- |' . "\n";
$markdown .= '| ' . $meta['return']['type'] . ' | ' . $meta['return']['description'] . ' |' . "\n";
return $markdown;
}
function generate_sidebar_config(string $title, array $items): array
{
return [
'title' => $title,
'collapsable' => true,
'children' => $items,
];
}
logger()->info('开始生成!');
// 遍历类并将元数据添加至数组中
foreach (new \RecursiveIteratorIterator($fs) as $file) {
if (!$file->isFile()) {
continue;
}
$path = $file->getPathname();
// 过滤不包含类的文件
$tokens = token_get_all(file_get_contents($path));
$found = false;
foreach ($tokens as $k => $token) {
if (!is_array($token)) {
continue;
}
if ($token[0] === T_CLASS && $tokens[$k - 2][0] !== T_NEW) {
$found = true;
break;
}
if ($k >= 100) {
break;
}
}
if (!$found) {
continue;
}
// 获取完整类名
$path = str_replace($root . '/', '', $path);
$class = str_replace(['.php', 'src/', '/'], ['', '', '\\'], $path);
logger()->debug('正在解析类:' . $class);
$meta = get_class_metas($class, $parser);
// 忽略不包含任何方法的类
if (empty($meta)) {
continue;
}
$metas[$class] = $meta;
++$class_count;
$method_count += count($meta);
}
// 将元数据转换为 Markdown
$markdown = [];
foreach ($metas as $class => $class_metas) {
$markdown[$class] = [];
// 将类名作为页面大标题
$markdown[$class]['class'] = '# ' . $class;
foreach ($class_metas as $method => $meta) {
$markdown[$class][$method] = convert_meta_to_markdown($method, $meta);
}
}
// 生成文档
$docs = $root . '/docs/api/';
foreach ($markdown as $class => $methods) {
$file = $docs . str_replace('\\', '/', $class) . '.md';
// 确保目录存在
if (!file_exists(dirname($file)) && !mkdir($concurrent_directory = dirname($file), 0777, true) && !is_dir($concurrent_directory)) {
throw new \RuntimeException(sprintf('无法建立目录 %s', $concurrent_directory));
}
logger()->debug('正在生成文档:' . $file);
$text = implode("\n\n", $methods);
file_put_contents($file, $text);
}
// 生成文档目录
$children = array_keys($markdown);
$children = str_replace('\\', '/', $children);
$class_tree = [];
foreach ($children as $child) {
$parent = dirname($child);
$class_tree[$parent][] = $child;
}
ksort($class_tree);
$config = 'module.exports = [';
foreach ($class_tree as $parent => $children) {
$encode = json_encode(generate_sidebar_config($parent, $children));
$encode = str_replace('\/', '/', $encode);
$config .= $encode . ',';
}
$config = rtrim($config, ',');
$config .= ']';
$file = $root . '/docs/.vuepress/api.js';
file_put_contents($file, $config);
if (count($warnings)) {
logger()->warning('生成过程中发现 ' . count($warnings) . ' 次警告');
if (!$show_warnings) {
logger()->info('生成器默认忽略了警告,你可以通过 gendoc --show-warnings 来查看警告');
}
}
if (count($errors)) {
logger()->error('生成过程中发现错误:');
foreach ($errors as $error) {
logger()->error($error);
}
}
logger()->notice('API 文档生成完毕');
logger()->notice(sprintf('共生成 %d 个类,共 %d 个方法', $class_count, $method_count));
// 完成生成,进行善后
exit(0);

View File

@@ -1,69 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Copyright: Swlib
* Author: Twosee <twose@qq.com>
* Date: 2018/4/14 下午10:58
*/
use Swoole\Coroutine;
Coroutine::set([
'log_level' => SWOOLE_LOG_INFO,
'trace_flags' => 0
]);
if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'Asia/Shanghai');
}
foreach ([
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php'
] as $file
) {
if (file_exists($file)) {
define('PHPUNIT_COMPOSER_INSTALL', $file);
break;
}
}
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
fwrite(
STDERR,
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
' composer install' . PHP_EOL . PHP_EOL .
'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
);
die(1);
} else {
if (array_reverse(explode('/', __DIR__))[0] ?? '' === 'test') {
$vendor_dir = dirname(PHPUNIT_COMPOSER_INSTALL);
$bin_unit = "{$vendor_dir}/bin/phpunit";
$unit_uint = "{$vendor_dir}/phpunit/phpunit/phpunit";
if (file_exists($bin_unit)) {
@unlink($bin_unit);
@symlink(__FILE__, $bin_unit);
}
if (file_exists($unit_uint)) {
@unlink($unit_uint);
@symlink(__FILE__, $unit_uint);
}
}
}
/** @noinspection PhpIncludeInspection */
require PHPUNIT_COMPOSER_INSTALL;
$starttime = microtime(true);
go(function () {
try {
require_once __DIR__.'/../test/bootstrap.php';
PHPUnit\TextUI\Command::main(false);
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
}
});
Swoole\Event::wait();
echo "Took " . round(microtime(true) - $starttime, 4) . "s\n";

65
bin/phpunit-zm Executable file
View File

@@ -0,0 +1,65 @@
#!/usr/bin/env php
<?php
/** For Swoole coroutine tests */
// 如果改成 true则会在终端显示所有炸毛框架的 Log
const ZM_TEST_LOG_DEBUG = false;
use OneBot\Driver\Event\Process\WorkerStartEvent;
use PHPUnit\TextUI\Command;
use Swoole\Atomic;
use Tests\ZMResultPrinter;
use ZM\Command\Server\ServerStartCommand;
use ZM\Event\EventProvider;
use ZM\Framework;
use ZM\Logger\ConsoleLogger;
use ZM\Store\MockAtomic;
// 引入自动加载
require dirname(__DIR__) . '/vendor/autoload.php';
// 声明一个全局的原子计数,用于保存整个进程的退出状态码
global $_swoole_atomic;
// Windows 没有 Swoole所以就使用了一个假的原子计数器反正 Windows 只有单进程
$_swoole_atomic = class_exists('\\Swoole\\Atomic') ? new Atomic() : new MockAtomic();
// 注册 Logger 等级
ob_logger_register(new ConsoleLogger(ZM_TEST_LOG_DEBUG ? 'debug' : 'error'));
// 使用框架自身的 EventProvider
global $ob_event_provider;
$ob_event_provider = new EventProvider();
// 注册一个最低级别的 WorkerStart 事件,用于在框架的事件初始化之后开始运行 PHPUnit
ob_event_provider()->addEventListener(WorkerStartEvent::getName(), function () {
register_shutdown_function(function () {
$error = error_get_last();
// 下面这段代码的作用就是,不是错误引发的退出时照常退出即可
if (($error['type'] ?? 0) != 0) {
logger()->emergency(zm_internal_errcode('E00027') . 'Internal fatal error: ' . $error['message'] . ' at ' . $error['file'] . "({$error['line']})");
}
Framework::getInstance()->stop();
});
$_SERVER['argv'][] = '--printer';
$_SERVER['argv'][] = ZMResultPrinter::class;
try {
// 不退出,而是返回 code
$retcode = Command::main(false);
} finally {
global $_swoole_atomic;
$_swoole_atomic->set($retcode ?? 0);
Framework::getInstance()->stop($retcode ?? 0);
}
}, 1);
try {
$options = ServerStartCommand::exportOptionArray();
$options['driver'] = 'workerman';
$options['worker-num'] = 1;
$options['private-mode'] = true;
(new Framework($options))->init()->start();
exit($_swoole_atomic->get());
} catch (Throwable $e) {
echo $e->getMessage() . PHP_EOL;
exit(1);
}

3
bin/phpunit-zm.bat Normal file
View File

@@ -0,0 +1,3 @@
@echo off
php %~dp0phpunit-zm %*

View File

@@ -5,7 +5,10 @@
# author: crazywhalecc
# since: 2.5.0
if [ -f "$(pwd)/runtime/php" ]; then
if [ "$ZM_CUSTOM_PHP_PATH" != "" ]; then
echo "* Using PHP executable: ""$ZM_CUSTOM_PHP_PATH"
executable="$ZM_CUSTOM_PHP_PATH"
elif [ -f "$(pwd)/runtime/php" ]; then
executable="$(pwd)/runtime/php"
echo "* Framework started with built-in php."
else

View File

@@ -1,56 +1,44 @@
{
"name": "zhamao/framework",
"description": "High performance chat robot and web server development framework",
"minimum-stability": "stable",
"license": "Apache-2.0",
"extra": {
"zm": {
"exclude-annotation-path": [
"src/ZM"
]
},
"hooks": {
"post-merge": "composer install",
"pre-commit": [
"echo committing as $(git config user.name)",
"./vendor/bin/php-cs-fixer fix --dry-run --diff ./src"
],
"pre-push": [
"./vendor/bin/php-cs-fixer fix --dry-run --diff ./src",
"composer analyse"
]
}
},
"authors": [
{
"name": "jerry",
"email": "admin@zhamao.me"
},
{
"name": "sunxyw",
"email": "dev@sunxyw.xyz"
}
],
"prefer-stable": true,
"bin": [
"bin/start",
"bin/phpunit-swoole",
"bin/watcher"
],
"require": {
"php": "^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1",
"php": "^8.0 || ^8.1",
"ext-json": "*",
"ext-posix": "*",
"ext-tokenizer": "*",
"doctrine/dbal": "^2.13.1",
"dragonmantank/cron-expression": "^3.3",
"jelix/version": "^2.0",
"koriym/attributes": "^1.0",
"psy/psysh": "^0.11.2",
"symfony/console": "~5.0 || ~4.0 || ~3.0",
"onebot/libonebot": "dev-develop",
"psr/container": "^2.0",
"psy/psysh": "^0.11.8",
"symfony/console": "^6.0",
"symfony/polyfill-ctype": "^1.19",
"symfony/polyfill-mbstring": "^1.19",
"symfony/polyfill-php80": "^1.16",
"symfony/routing": "~5.0 || ~4.0 || ~3.0",
"zhamao/config": "^1.0",
"zhamao/connection-manager": "^1.0",
"zhamao/console": "^1.0",
"zhamao/request": "^1.1"
"symfony/routing": "~6.0 || ~5.0 || ~4.0"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^3.0",
"friendsofphp/php-cs-fixer": "^3.2 != 3.7.0",
"jetbrains/phpstorm-attributes": "^1.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^8.5 || ^9.0",
"roave/security-advisories": "dev-latest",
"swoole/ide-helper": "^4.5"
},
"suggest": {
"ext-ctype": "Use C/C++ extension instead of polyfill will be more efficient",
@@ -59,36 +47,60 @@
"ext-redis": "If you use Redis in framework, you will need this extension",
"league/climate": "Display columns and status in terminal"
},
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"ZM\\": "src/ZM"
},
"files": [
"src/ZM/global_functions.php"
"src/Globals/global_functions.php",
"src/Globals/global_defines_app.php",
"src/Globals/global_class_alias.php"
]
},
"autoload-dev": {
"psr-4": {
"Module\\": "src/Module",
"Custom\\": "src/Custom"
"Tests\\": "tests"
}
},
"bin": [
"bin/gendoc",
"bin/phpunit-zm",
"bin/zhamao"
],
"config": {
"optimize-autoloader": true,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.8",
"friendsofphp/php-cs-fixer": "^3.2 != 3.7.0",
"phpstan/phpstan": "^1.1",
"phpunit/phpunit": "^8.5 || ^9.0",
"swoole/ide-helper": "^4.5"
"extra": {
"hooks": {
"post-merge": "composer install",
"pre-commit": [
"echo committing as $(git config user.name)",
"composer cs-fix -- --diff"
],
"pre-push": [
"composer cs-fix -- --dry-run --diff",
"composer analyse"
]
},
"zm": {
"exclude-annotation-path": [
"src/ZM",
"tests"
]
}
},
"scripts": {
"post-install-cmd": [
"[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/cghooks add"
],
"analyse": "phpstan analyse --memory-limit 300M -l 0 ./src",
"cs-fix": "php-cs-fixer fix $1"
"analyse": "phpstan analyse --memory-limit 300M",
"cs-fix": "php-cs-fixer fix",
"test": "bin/phpunit-zm --no-coverage"
}
}

View File

@@ -1,152 +1,110 @@
<?php
/** @noinspection PhpComposerExtensionStubsInspection */
declare(strict_types=1);
/* bind host */
$config['host'] = '0.0.0.0';
/* 启动框架的底层驱动(原生支持 swoole、workerman 两种) */
$config['driver'] = 'workerman';
/* bind port */
$config['port'] = 20001;
/* 框架开到公网或外部的HTTP访问链接通过 DataProvider::getFrameworkLink() 获取 */
$config['http_reverse_link'] = 'http://127.0.0.1:' . $config['port'];
/* 框架是否启动debug模式当debug模式为true时启用热更新需要安装inotify扩展 */
$config['debug_mode'] = false;
/* 存放框架内文件数据的目录 */
$config['zm_data'] = realpath(WORKING_DIR) . '/zm_data/';
/* 存放各个模块配置文件的目录 */
$config['config_dir'] = $config['zm_data'] . 'config/';
/* 存放崩溃和运行日志的目录 */
$config['crash_dir'] = $config['zm_data'] . 'crash/';
/* 对应swoole的server->set参数 */
$config['swoole'] = [
'log_file' => $config['crash_dir'] . 'swoole_error.log',
// 'worker_num' => swoole_cpu_num(), //如果你只有一个 OneBot 实例连接到框架并且代码没有复杂的CPU密集计算则可把这里改为1使用全局变量
'dispatch_mode' => 2, // 包分配原则,见 https://wiki.swoole.com/#/server/setting?id=dispatch_mode
'max_coroutine' => 300000,
'max_wait_time' => 5,
// 'task_worker_num' => 4,
// 'task_enable_coroutine' => true
/* 要启动的服务器监听端口及协议 */
$config['servers'] = [
[
'host' => '0.0.0.0',
'port' => 20001,
'type' => 'websocket',
],
[
'host' => '0.0.0.0',
'port' => 20002,
'type' => 'http',
'flag' => 20002,
],
[
'host' => '0.0.0.0',
'port' => 20003,
'type' => 'http',
'flag' => 20003,
],
];
/* 一些框架与框架运行时设置的调整 */
/* Workerman 驱动相关配置 */
$config['workerman_options'] = [
'worker_num' => 1, // 如果你只有一个 OneBot 实例连接到框架并且代码没有复杂的CPU密集计算则可把这里改为1使用全局变量
];
/* Swoole 驱动相关配置 */
$config['swoole_options'] = [
'coroutine_hook_flags' => SWOOLE_HOOK_ALL & (~SWOOLE_HOOK_CURL), // 协程 Hook 内容
'swoole_set' => [
'worker_num' => 1, // 如果你只有一个 OneBot 实例连接到框架并且代码没有复杂的CPU密集计算则可把这里改为1使用全局变量
'dispatch_mode' => 2, // 包分配原则,见 https://wiki.swoole.com/#/server/setting?id=dispatch_mode
'max_coroutine' => 300000, // 允许最大的协程数
'max_wait_time' => 5, // 安全退出模式下允许等待 Worker 的最长秒数
// 'task_worker_num' => 4, // 启动 TaskWorker 进程的数量(默认不启动)
// 'task_enable_coroutine' => true // TaskWorker 是否开启协程
],
'swoole_server_mode' => SWOOLE_PROCESS, // Swoole Server 启动模式,默认为 SWOOLE_PROCESS
];
/* 默认存取炸毛数据的目录相对目录时代表WORKING_DIR下的目录绝对目录按照绝对目录来 */
$config['data_dir'] = 'zm_data';
/* 框架本体运行时的一些可调配置 */
$config['runtime'] = [
'swoole_coroutine_hook_flags' => SWOOLE_HOOK_ALL & (~SWOOLE_HOOK_CURL),
'swoole_server_mode' => SWOOLE_PROCESS,
'middleware_error_policy' => 1,
'reload_delay_time' => 800,
'global_middleware_binding' => [],
'save_console_log_file' => false, // 改为目标路径,则将 Console 输出的日志保存到文件
'annotation_reader_ignore' => [ // 设置注解解析器忽略的注解名或命名空间,防止解析到不该解析的
'name' => [
'mixin',
],
'namespace' => [],
],
'timezone' => 'Asia/Shanghai',
];
/* 轻量字符串缓存,默认开启 */
$config['light_cache'] = [
'size' => 512, // 最多允许储存的条数需要2的倍数
'max_strlen' => 32768, // 单行字符串最大长度需要2的倍数
'hash_conflict_proportion' => 0.6, // Hash冲突率越大越好但是需要的内存更多
'persistence_path' => $config['zm_data'] . '_cache.json',
'auto_save_interval' => 900,
];
/* 大容量跨进程变量存储2.2.0可用) */
$config['worker_cache'] = [
'worker' => 0,
'transaction_timeout' => 30000,
];
/* MySQL数据库连接信息host留空则启动时不创建sql连接池 */
$config['mysql_config'] = [
'host' => '',
'port' => 3306,
'unix_socket' => null,
'username' => 'root',
'password' => '123456',
'dbname' => '',
'charset' => 'utf8mb4',
'pool_size' => 64,
'options' => [
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
],
];
/* Redis连接信息host留空则启动时不创建Redis连接池 */
$config['redis_config'] = [
'host' => '',
'port' => 6379,
'timeout' => 1,
'db_index' => 0,
'auth' => '',
];
/* onebot连接约定的token */
$config['access_token'] = '';
/* HTTP服务器固定请求头的返回 */
$config['http_header'] = [
'Server' => 'zhamao-framework',
'Content-Type' => 'text/html; charset=utf-8',
];
/* HTTP服务器在指定状态码下回复的页面默认 */
$config['http_default_code_page'] = [
'404' => '404.html',
];
/* zhamao-framework在框架启动时初始化的atomic们 */
$config['init_atomics'] = [
// 'custom_atomic_name' => 0, //自定义添加的Atomic
];
/* 终端日志显示等级0-4 */
$config['info_level'] = 2;
/* 上下文接口类 implemented from ContextInterface */
$config['context_class'] = \ZM\Context\Context::class;
/* 静态文件访问 */
$config['static_file_server'] = [
'status' => false,
'document_root' => realpath(__DIR__ . '/../') . '/resources/html',
'document_index' => [
'index.html',
/* 允许加载插件形式 */
$config['plugin'] = [
'enable' => true,
'load_dir' => 'plugins',
];
/* 内部默认启用的插件 */
$config['native_plugin'] = [
'onebot12' => true, // OneBot v12 协议支持
'onebot12-ban-other-ws' => true, // OneBot v12 协议支持,禁止其他 WebSocket 连接
];
/* 静态文件读取器 */
$config['file_server'] = [
'enable' => true,
'document_root' => $config['data_dir'] . '/public/',
'document_index' => 'index.html',
'document_code_page' => [
'404' => '404.html',
'500' => '500.html',
],
];
/* 机器人解析模块关闭后无法使用如CQCommand等注解(上面的modules即将废弃) */
$config['onebot'] = [
'status' => true,
'single_bot_mode' => false,
'message_level' => 99,
'message_convert_string' => true,
'message_command_policy' => 'interrupt',
];
/* 一个远程简易终端使用nc直接连接即可但是不建议开放host为0.0.0.0(远程连接) */
$config['remote_terminal'] = [
'status' => false,
'host' => '127.0.0.1',
'port' => 20002,
'token' => '',
];
/* 模块(插件)加载器的相关设置 */
$config['module_loader'] = [
'enable_hotload' => false,
'load_path' => $config['zm_data'] . 'modules',
/* MySQL 和 SQLite3 数据库连接配置,框架将自动生成连接池,支持多个连接池 */
$config['database'] = [
'sqlite_db1' => [
'enable' => false,
'type' => 'sqlite',
'dbname' => 'a.db',
'pool_size' => 10,
],
'zm' => [
'enable' => false,
'type' => 'mysql',
'host' => '127.0.0.1', // 填写数据库服务器地址后才会创建数据库连接
'port' => 3306,
'username' => 'root',
'password' => 'ZhamaoTEST',
'dbname' => 'zm',
'charset' => 'utf8mb4',
'pool_size' => 64,
],
];
return $config;

152
config/global_old.php Normal file
View File

@@ -0,0 +1,152 @@
<?php
/** @noinspection PhpComposerExtensionStubsInspection */
declare(strict_types=1);
/* bind host */
$config['host'] = '0.0.0.0';
/* bind port */
$config['port'] = 20001;
/* 框架开到公网或外部的HTTP访问链接通过 DataProvider::getFrameworkLink() 获取 */
$config['http_reverse_link'] = 'http://127.0.0.1:' . $config['port'];
/* 框架是否启动debug模式当debug模式为true时启用热更新需要安装inotify扩展 */
$config['debug_mode'] = false;
/* 存放框架内文件数据的目录 */
$config['zm_data'] = realpath(WORKING_DIR) . '/zm_data/';
/* 存放各个模块配置文件的目录 */
$config['config_dir'] = $config['zm_data'] . 'config/';
/* 存放崩溃和运行日志的目录 */
$config['crash_dir'] = $config['zm_data'] . 'crash/';
/* 对应swoole的server->set参数 */
$config['swoole'] = [
'log_file' => $config['crash_dir'] . 'swoole_error.log',
// 'worker_num' => swoole_cpu_num(), //如果你只有一个 OneBot 实例连接到框架并且代码没有复杂的CPU密集计算则可把这里改为1使用全局变量
'dispatch_mode' => 2, // 包分配原则,见 https://wiki.swoole.com/#/server/setting?id=dispatch_mode
'max_coroutine' => 300000,
'max_wait_time' => 5,
// 'task_worker_num' => 4,
// 'task_enable_coroutine' => true
];
/* 一些框架与框架运行时设置的调整 */
$config['runtime'] = [
'swoole_coroutine_hook_flags' => SWOOLE_HOOK_ALL & (~SWOOLE_HOOK_CURL),
'swoole_server_mode' => SWOOLE_PROCESS,
'middleware_error_policy' => 1,
'reload_delay_time' => 800,
'global_middleware_binding' => [],
'save_console_log_file' => false, // 改为目标路径,则将 Console 输出的日志保存到文件
'annotation_reader_ignore' => [ // 设置注解解析器忽略的注解名或命名空间,防止解析到不该解析的
'name' => [
'mixin',
],
'namespace' => [],
],
];
/* 轻量字符串缓存,默认开启 */
$config['light_cache'] = [
'size' => 512, // 最多允许储存的条数需要2的倍数
'max_strlen' => 32768, // 单行字符串最大长度需要2的倍数
'hash_conflict_proportion' => 0.6, // Hash冲突率越大越好但是需要的内存更多
'persistence_path' => $config['zm_data'] . '_cache.json',
'auto_save_interval' => 900,
];
/* 大容量跨进程变量存储2.2.0可用) */
$config['worker_cache'] = [
'worker' => 0,
'transaction_timeout' => 30000,
];
/* MySQL数据库连接信息host留空则启动时不创建sql连接池 */
$config['mysql_config'] = [
'host' => '',
'port' => 3306,
'unix_socket' => null,
'username' => 'root',
'password' => '123456',
'dbname' => '',
'charset' => 'utf8mb4',
'pool_size' => 64,
'options' => [
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
],
];
/* Redis连接信息host留空则启动时不创建Redis连接池 */
$config['redis_config'] = [
'host' => '',
'port' => 6379,
'timeout' => 1,
'db_index' => 0,
'auth' => '',
];
/* onebot连接约定的token */
$config['access_token'] = '';
/* HTTP服务器固定请求头的返回 */
$config['http_header'] = [
'Server' => 'zhamao-framework',
'Content-Type' => 'text/html; charset=utf-8',
];
/* HTTP服务器在指定状态码下回复的页面默认 */
$config['http_default_code_page'] = [
'404' => '404.html',
];
/* zhamao-framework在框架启动时初始化的atomic们 */
$config['init_atomics'] = [
// 'custom_atomic_name' => 0, //自定义添加的Atomic
];
/* 终端日志显示等级0-4 */
$config['info_level'] = 2;
/* 上下文接口类 implemented from ContextInterface */
$config['context_class'] = \ZM\Context\Context::class;
/* 静态文件访问 */
$config['static_file_server'] = [
'status' => false,
'document_root' => realpath(__DIR__ . '/../') . '/resources/html',
'document_index' => [
'index.html',
],
];
/* 机器人解析模块关闭后无法使用如CQCommand等注解(上面的modules即将废弃) */
$config['onebot'] = [
'status' => true,
'single_bot_mode' => false,
'message_level' => 99,
'message_convert_string' => true,
'message_command_policy' => 'interrupt',
];
/* 一个远程简易终端使用nc直接连接即可但是不建议开放host为0.0.0.0(远程连接) */
$config['remote_terminal'] = [
'status' => false,
'host' => '127.0.0.1',
'port' => 20002,
'token' => '',
];
/* 模块(插件)加载器的相关设置 */
$config['module_loader'] = [
'enable_hotload' => false,
'load_path' => $config['zm_data'] . 'modules',
];
return $config;

96
docker-compose.yml Normal file
View File

@@ -0,0 +1,96 @@
version: "3.9"
services:
bot:
build:
context: docker/zhamao
dockerfile: ./Dockerfile
container_name: zhamao-bot
depends_on:
- database-postgres
- database-redis
networks:
- bot-net
ports:
- "20001-20005:20001-20005/tcp"
volumes:
- ".:/bot"
walle-q:
build:
context: docker/walle-q
dockerfile: ./Dockerfile
container_name: zhamao-bot-walle-q
depends_on:
- bot
networks:
- bot-net
volumes:
- "./docker/volumes/walle-q-data:/bot"
database-postgres:
container_name: zhamao-bot-db-postgres
env_file:
- docker/environment.env
image: postgres:14.4-alpine
networks:
- bot-net
ports:
- "5432:5432/tcp"
restart: always
volumes:
- "./docker/volumes/postgres-data:/var/lib/postgresql/data"
- "./docker/volumes/postgres-init:/docker-entrypoint-initdb.d"
database-redis:
command:
- redis-server
- --requirepass
- "$${REDIS_PASSWORD}"
container_name: zhamao-bot-db-redis
env_file:
- docker/environment.env
image: redis:7.0-alpine
networks:
- bot-net
ports:
- "6379:6379/tcp"
restart: always
volumes:
- "./docker/volumes/redis-data:/data"
db-admin-adminer:
container_name: zhamao-bot-dbadmin-adminer
depends_on:
database-postgres:
condition: service_started
database-redis:
condition: service_started
env_file:
- docker/environment.env
image: adminer:latest
networks:
- bot-net
ports:
- "15432:8080/tcp"
profiles:
- with-adminer
db-admin-redis-insight:
container_name: zhamao-bot-dbadmin-redis-insight
depends_on:
database-postgres:
condition: service_started
database-redis:
condition: service_started
image: redislabs/redisinsight:latest
networks:
- bot-net
ports:
- "16379:8001/tcp"
profiles:
- with-adminer
networks:
bot-net:
name: bot-net

2
docker/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/volumes
environment.env

View File

@@ -0,0 +1,7 @@
REDIS_PASSWORD={{$REDIS_PASSWORD}}
POSTGRES_USER={{$DB_ROOT_USER}}
POSTGRES_PASSWORD={{$DB_ROOT_PASSWORD}}
POSTGRES_APPLICATION_USER={{$DB_USER}}
POSTGRES_APPLICATION_USER_PASSWORD={{$DB_PASSWORD}}
POSTGRES_APPLICATION_DATABASE={{$DB_NAME}}

14
docker/walle-q/Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM alpine:latest
MAINTAINER sunxyw <me@sunxyw.xyz>
RUN apk add --no-cache curl
RUN mkdir -p /bot && \
curl -fsSL https://github.com/onebot-walle/walle-q/releases/latest/download/walle-q-i686-linux-musl.tar.gz -O && \
tar -zxvf walle-q-i686-linux-musl.tar.gz -C /bot && \
rm -rf walle-q-i686-linux-musl.tar.gz && \
chmod +x /bot/walle-q-i686-linux-musl
ENV TZ=Asia/Shanghai
ENTRYPOINT [ "/bot/walle-q-i686-linux-musl" ]

14
docker/zhamao/Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM phpswoole/swoole:5.0-php8.1
MAINTAINER sunxyw <me@sunxyw.xyz>
WORKDIR "/bot"
ENV TZ=Asia/Shanghai
EXPOSE 20001-20005
RUN docker-php-ext-install pcntl
ENTRYPOINT [ "./zhamao" ]
CMD [ "server" ]

1
docs/.vuepress/api.js Normal file
View File

@@ -0,0 +1 @@
module.exports = [{"title":"ZM","collapsable":true,"children":["ZM/ZMApplication","ZM/ConsoleApplication"]},{"title":"ZM/Annotation","collapsable":true,"children":["ZM/Annotation/AnnotationHandler","ZM/Annotation/AnnotationMap","ZM/Annotation/AnnotationParser","ZM/Annotation/AnnotationBase"]},{"title":"ZM/Command","collapsable":true,"children":["ZM/Command/InitCommand","ZM/Command/Command","ZM/Command/ProxyServerCommand","ZM/Command/BuildCommand"]},{"title":"ZM/Command/Server","collapsable":true,"children":["ZM/Command/Server/ServerStartCommand","ZM/Command/Server/ServerCommand"]},{"title":"ZM/Config","collapsable":true,"children":["ZM/Config/ZMConfig","ZM/Config/ConfigTracer"]},{"title":"ZM/Container","collapsable":true,"children":["ZM/Container/ContainerServicesProvider","ZM/Container/BoundMethod","ZM/Container/WorkerContainer","ZM/Container/Container"]},{"title":"ZM/Context","collapsable":true,"children":["ZM/Context/Context"]},{"title":"ZM/Event","collapsable":true,"children":["ZM/Event/EventProvider","ZM/Event/EventDispatcher"]},{"title":"ZM/Event/Listener","collapsable":true,"children":["ZM/Event/Listener/MasterEventListener","ZM/Event/Listener/ManagerEventListener","ZM/Event/Listener/HttpEventListener","ZM/Event/Listener/WorkerEventListener","ZM/Event/Listener/SignalListener","ZM/Event/Listener/WSEventListener"]},{"title":"ZM/Middleware","collapsable":true,"children":["ZM/Middleware/MiddlewareHandler","ZM/Middleware/Pipeline"]},{"title":"ZM/Plugin","collapsable":true,"children":["ZM/Plugin/PluginManager","ZM/Plugin/OneBot12Adapter"]},{"title":"ZM/Process","collapsable":true,"children":["ZM/Process/ProcessStateManager"]},{"title":"ZM/Store","collapsable":true,"children":["ZM/Store/FileSystem"]},{"title":"ZM/Store/Database","collapsable":true,"children":["ZM/Store/Database/DBWrapper","ZM/Store/Database/DBStatement","ZM/Store/Database/DBPool","ZM/Store/Database/DBStatementWrapper","ZM/Store/Database/DBConnection","ZM/Store/Database/DBQueryBuilder"]},{"title":"ZM/Store/Lock","collapsable":true,"children":["ZM/Store/Lock/FileLock"]},{"title":"ZM/Utils","collapsable":true,"children":["ZM/Utils/EasterEgg","ZM/Utils/ConnectionUtil","ZM/Utils/ReflectionUtil","ZM/Utils/ZMUtil","ZM/Utils/HttpUtil"]}]

View File

@@ -4,7 +4,7 @@
<div v-for="i in chat" v-bind="i">
<div class="doc-chat-row" v-if="i.type === 0">
<div class="doc-chat-box">{{ i.content }}</div>
<img class="doc-chat-avatar" src="http://api.btstu.cn/sjtx/api.php" alt=""/>
<img class="doc-chat-avatar" src="https://api.btstu.cn/sjtx/api.php" alt=""/>
</div>
<div class="doc-chat-row doc-chat-row-robot" v-else-if="i.type === 1">
<img class="doc-chat-avatar" src="https://docs-v1.zhamao.xin/logo.png" alt=""/>
@@ -138,4 +138,4 @@ export default {
height: 36px !important;
border-radius: 18px;
}
</style>
</style>

View File

@@ -1,6 +1,8 @@
const apiConfig = require('./api')
module.exports = {
title: '炸毛框架',
description: '一个聊天机器人 + Web 框架',
description: '一个高性能聊天机器人 + Web 框架',
theme: 'antdocs',
markdown: {
lineNumbers: true
@@ -29,6 +31,7 @@ module.exports = {
{ text: '事件和注解', link: '/event/' },
{ text: '组件', link: '/component/' },
{ text: '进阶', link: '/advanced/' },
{ text: 'API', link: '/api/' },
{ text: 'FAQ', link: '/faq/' },
{ text: '更新日志', link: '/update/v2/' },
{ text: '炸毛框架 v1', link: 'https://docs-v1.zhamao.xin/' }
@@ -161,6 +164,7 @@ module.exports = {
]
},
],
'/api/': apiConfig,
'/faq/': [
'',
'to-v2',
@@ -185,4 +189,4 @@ module.exports = {
]
}
}
}
}

View File

@@ -21,17 +21,16 @@ footer: |
## 安装框架和环境
此命令可一键以模板安装 `zhamao-framework``PHP` 独立环境到目录下,无需 root!(仅限 Linux
此命令可一键以模板安装框架!(仅限 Linux 和 macOS
```bash
mkdir my-app
cd my-app
bash -c "$(curl -fsSL https://api.zhamao.xin/go.sh)"
bash <(curl -fsSL https://zhamao.xin/go.sh)
```
## 运行框架
```bash
cd zhamao-app/
./zhamao server
```

618
docs/api/ZM/API/CQ.md Normal file
View File

@@ -0,0 +1,618 @@
# ZM\API\CQ
## at
```php
public function at(int|string $qq): string
```
### 描述
at一下QQ用户仅在QQ群支持at全体
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| qq | int|string | 用户QQ号/ID号 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## face
```php
public function face(int|string $id): string
```
### 描述
发送QQ原生表情
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| id | int|string | 表情ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## image
```php
public function image(string $file, bool $cache, bool $flash, bool $proxy, int $timeout): string
```
### 描述
发送图片
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| file | string | 文件的路径、URL或者base64编码的图片数据 |
| cache | bool | 是否缓存默认为true |
| flash | bool | 是否闪照默认为false |
| proxy | bool | 是否使用代理默认为true |
| timeout | int | 超时时间(默认不超时) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## record
```php
public function record(string $file, bool $magic, bool $cache, bool $proxy, int $timeout): string
```
### 描述
发送语音
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| file | string | 文件的路径、URL或者base64编码的语音数据 |
| magic | bool | 是否加特技默认为false |
| cache | bool | 是否缓存默认为true |
| proxy | bool | 是否使用代理默认为true |
| timeout | int | 超时时间(默认不超时) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## video
```php
public function video(string $file, bool $cache, bool $proxy, int $timeout): string
```
### 描述
发送短视频
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| file | string | 文件的路径、URL或者base64编码的短视频数据 |
| cache | bool | 是否缓存默认为true |
| proxy | bool | 是否使用代理默认为true |
| timeout | int | 超时时间(默认不超时) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## rps
```php
public function rps(): string
```
### 描述
发送投掷骰子(只能在单条回复中单独使用)
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## dice
```php
public function dice(): string
```
### 描述
发送掷骰子表情(只能在单条回复中单独使用)
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## shake
```php
public function shake(): string
```
### 描述
戳一戳(原窗口抖动,仅支持好友消息使用)
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## poke
```php
public function poke(int|string $type, int|string $id, string $name): string
```
### 描述
发送新的戳一戳
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| type | int|string | 焯一戳类型 |
| id | int|string | 戳一戳ID号 |
| name | string | 戳一戳名称(可选) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## anonymous
```php
public function anonymous(int $ignore): string
```
### 描述
发送匿名消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| ignore | int | 是否忽略错误默认为10表示不忽略错误 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## share
```php
public function share(string $url, string $title, null|string $content, null|string $image): string
```
### 描述
发送链接分享(只能在单条回复中单独使用)
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| url | string | 分享地址 |
| title | string | 标题 |
| content | null|string | 卡片内容(可选) |
| image | null|string | 卡片图片(可选) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## contact
```php
public function contact(int|string $type, int|string $id): string
```
### 描述
发送好友或群推荐名片
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| type | int|string | 名片类型 |
| id | int|string | 好友或群ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## location
```php
public function location(float|string $lat, float|string $lon, string $title, string $content): string
```
### 描述
发送位置
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| lat | float|string | 纬度 |
| lon | float|string | 经度 |
| title | string | 标题(可选) |
| content | string | 卡片内容(可选) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## music
```php
public function music(string $type, int|string $id_or_url, null|string $audio, null|string $title, null|string $content, null|string $image): string
```
### 描述
发送音乐分享(只能在单条回复中单独使用)
qq、163、xiami为内置分享需要先通过搜索功能获取id后使用
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| type | string | 分享类型(仅限 `qq``163``xiami``custom` |
| id_or_url | int|string | 当分享类型不是 `custom`表示的是分享音乐的ID需要先通过搜索功能获取id后使用反之表示的是音乐卡片点入的链接 |
| audio | null|string | 当分享类型是 `custom`表示为音乐如mp3文件的HTTP链接地址不可为空 |
| title | null|string | 当分享类型是 `custom`表示为音乐卡片的标题建议12字以内不可为空 |
| content | null|string | 当分享类型是 `custom` 时,表示为音乐卡片的简介(可忽略) |
| image | null|string | 当分享类型是 `custom` 时,表示为音乐卡片的图片链接地址(可忽略) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## forward
```php
public function forward(int|string $id): string
```
### 描述
合并转发消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| id | int|string | 合并转发ID, 需要通过 `/get_forward_msg` API获取转发的具体内容 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## node
```php
public function node(int|string $user_id, string $nickname, string $content): string
```
### 描述
合并转发消息节点
特殊说明: 需要使用单独的API /send_group_forward_msg 发送, 并且由于消息段较为复杂, 仅支持Array形式入参。
如果引用消息和自定义消息同时出现, 实际查看顺序将取消息段顺序。
另外按 CQHTTP 文档说明, data 应全为字符串, 但由于需要接收message 类型的消息, 所以 仅限此Type的content字段 支持Array套娃
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| user_id | int|string | 转发消息id |
| nickname | string | 发送者显示名字 |
| content | string | 具体消息 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## xml
```php
public function xml(string $data): string
```
### 描述
XML消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | string | xml内容, xml中的value部分 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## json
```php
public function json(string $data, int $resid): string
```
### 描述
JSON消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | string | json内容 |
| resid | int | 0为走小程序通道其他值为富文本通道默认为0 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## _custom
```php
public function _custom(string $type_name, array $params): string
```
### 描述
返回一个自定义扩展的CQ码支持自定义类型和参数
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| type_name | string | CQ码类型名称 |
| params | array | 参数 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | CQ码 |
## decode
```php
public function decode(int|string|Stringable $msg, bool $is_content): string
```
### 描述
反转义字符串中的CQ码敏感符号
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| msg | int|string|Stringable | 字符串 |
| is_content | bool | 如果是解码CQ码本体内容则为false默认如果是参数内的字符串则为true |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | 转义后的CQ码 |
## replace
```php
public function replace(int|string|Stringable $str): string
```
### 描述
简单反转义替换CQ码的方括号
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| str | int|string|Stringable | 字符串 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | 字符串 |
## escape
```php
public function escape(int|string|Stringable $msg, bool $is_content): string
```
### 描述
转义CQ码的特殊字符同encode
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| msg | int|string|Stringable | 字符串 |
| is_content | bool | 如果是转义CQ码本体内容则为false默认如果是参数内的字符串则为true |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | 转义后的CQ码 |
## encode
```php
public function encode(int|string|Stringable $msg, bool $is_content): string
```
### 描述
转义CQ码的特殊字符
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| msg | int|string|Stringable | 字符串 |
| is_content | bool | 如果是转义CQ码本体内容则为false默认如果是参数内的字符串则为true |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | 转义后的CQ码 |
## removeCQ
```php
public function removeCQ(string $msg): string
```
### 描述
移除消息中所有的CQ码并返回移除CQ码后的消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| msg | string | 消息 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | 消息内容 |
## getCQ
```php
public function getCQ(string $msg, bool $is_object): null|array|CQObject
```
### 描述
获取消息中第一个CQ码
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| msg | string | 消息内容 |
| is_object | bool | 是否以对象形式返回如果为False的话返回数组形式默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| null|array|CQObject | 返回的CQ码数组或对象 |
## getAllCQ
```php
public function getAllCQ(string $msg, bool $is_object): array|CQObject[]
```
### 描述
获取消息中所有的CQ码
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| msg | string | 消息内容 |
| is_object | bool | 是否以对象形式返回如果为False的话返回数组形式默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|CQObject[] | 返回的CQ码们数组或对象 |

View File

@@ -0,0 +1,130 @@
# ZM\API\GoCqhttpAPIV11
## getGuildServiceProfile
```php
public function getGuildServiceProfile(): array|bool
```
### 描述
获取频道系统内BOT的资料
响应字段nickname, tiny_id, avatar_url
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGuildList
```php
public function getGuildList(): array|bool
```
### 描述
获取频道列表
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGuildMetaByGuest
```php
public function getGuildMetaByGuest(int|string $guild_id): array|bool
```
### 描述
通过访客获取频道元数据
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| guild_id | int|string | 频道ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGuildChannelList
```php
public function getGuildChannelList(int|string $guild_id, false $no_cache): array|bool
```
### 描述
获取子频道列表
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| guild_id | int|string | 频道ID |
| no_cache | false | 禁用缓存默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGuildMembers
```php
public function getGuildMembers(int|string $guild_id): array|bool
```
### 描述
获取频道成员列表
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| guild_id | int|string | 频道ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## sendGuildChannelMsg
```php
public function sendGuildChannelMsg(int|string $guild_id, int|string $channel_id, string $message): array|bool
```
### 描述
发送信息到子频道
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| guild_id | int|string | 频道ID |
| channel_id | int|string | 子频道ID |
| message | string | 信息内容 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |

View File

@@ -0,0 +1,984 @@
# ZM\API\OneBotV11
## get
```php
public function get(int|string $robot_id): ZMRobot
```
### 描述
获取机器人Action/API实例
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| robot_id | int|string | 机器人ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZMRobot | 机器人实例 |
## getRandom
```php
public function getRandom(): ZMRobot
```
### 描述
随机获取一个连接到框架的机器人实例
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZMRobot | 机器人实例 |
## getAllRobot
```php
public function getAllRobot(): ZMRobot[]
```
### 描述
获取所有机器人实例
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZMRobot[] | 机器人实例们 |
## setCallback
```php
public function setCallback(bool|Closure $callback): OneBotV11
```
### 描述
设置回调或启用协程等待API回包
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| callback | bool|Closure | 是否开启协程或设置异步回调函数如果为true则协程等待结果如果为false则异步执行并不等待结果如果为回调函数则异步执行且调用回调 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| OneBotV11 | 返回本身 |
## setPrefix
```php
public function setPrefix(int $prefix): OneBotV11
```
### 描述
设置API调用类型后缀
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| prefix | int | 设置后缀类型API_NORMAL为不加后缀API_ASYNC为异步调用API_RATE_LIMITED为加后缀并且限制调用频率 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| OneBotV11 | 返回本身 |
## sendPrivateMsg
```php
public function sendPrivateMsg(int|string $user_id, string $message, bool $auto_escape): array|bool
```
### 描述
发送私聊消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| user_id | int|string | 用户ID |
| message | string | 消息内容 |
| auto_escape | bool | 是否自动转义默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## sendGroupMsg
```php
public function sendGroupMsg(int|string $group_id, string $message, bool $auto_escape): array|bool
```
### 描述
发送群消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群组ID |
| message | string | 消息内容 |
| auto_escape | bool | 是否自动转义默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## sendMsg
```php
public function sendMsg(string $message_type, int|string $target_id, string $message, bool $auto_escape): array|bool
```
### 描述
发送消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message_type | string | 消息类型 |
| target_id | int|string | 目标ID |
| message | string | 消息内容 |
| auto_escape | bool | 是否自动转义默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## deleteMsg
```php
public function deleteMsg(int|string $message_id): array|bool
```
### 描述
撤回消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message_id | int|string | 消息ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getMsg
```php
public function getMsg(int|string $message_id): array|bool
```
### 描述
获取消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message_id | int|string | 消息ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getForwardMsg
```php
public function getForwardMsg(int|string $id): array|bool
```
### 描述
获取合并转发消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| id | int|string | ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## sendLike
```php
public function sendLike(int|string $user_id, int $times): array|bool
```
### 描述
发送好友赞
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| user_id | int|string | 用户ID |
| times | int | 时间 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupKick
```php
public function setGroupKick(int|string $group_id, int|string $user_id, bool $reject_add_request): array|bool
```
### 描述
群组踢人
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| user_id | int|string | 用户ID |
| reject_add_request | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupBan
```php
public function setGroupBan(int|string $group_id, int|string $user_id, int $duration): array|bool
```
### 描述
群组单人禁言
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| user_id | int|string | 用户ID |
| duration | int | 禁言时长 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupAnonymousBan
```php
public function setGroupAnonymousBan(int|string $group_id, array|int|string $anonymous_or_flag, int $duration): array|bool
```
### 描述
群组匿名用户禁言
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| anonymous_or_flag | array|int|string | 匿名禁言Flag或匿名用户对象 |
| duration | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupWholeBan
```php
public function setGroupWholeBan(int|string $group_id, bool $enable): array|bool
```
### 描述
群组全员禁言
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| enable | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupAdmin
```php
public function setGroupAdmin(int|string $group_id, int|string $user_id, bool $enable): array|bool
```
### 描述
群组设置管理员
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| user_id | int|string | 用户ID |
| enable | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupAnonymous
```php
public function setGroupAnonymous(int|string $group_id, bool $enable): array|bool
```
### 描述
群组匿名
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| enable | bool | 是否启用默认为true |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupCard
```php
public function setGroupCard(int|string $group_id, int|string $user_id, string $card): array|bool
```
### 描述
设置群名片(群备注)
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| user_id | int|string | 用户ID |
| card | string | 名片内容(默认为空) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupName
```php
public function setGroupName(int|string $group_id, string $group_name): array|bool
```
### 描述
设置群名
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| group_name | string | 群名 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupLeave
```php
public function setGroupLeave(int|string $group_id, bool $is_dismiss): array|bool
```
### 描述
退出群组
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| is_dismiss | bool | 是否解散默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupSpecialTitle
```php
public function setGroupSpecialTitle(int|string $group_id, int|string $user_id, string $special_title, int $duration): array|bool
```
### 描述
设置群组专属头衔
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| user_id | int|string | 用户ID |
| special_title | string | 专属头衔内容 |
| duration | int | 持续时间(默认为-1永久 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setFriendAddRequest
```php
public function setFriendAddRequest(array|int|string $flag, bool $approve, string $remark): array|bool
```
### 描述
处理加好友请求
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| flag | array|int|string | 处理加好友请求的flag |
| approve | bool | 是否同意默认为true |
| remark | string | 设置昵称(默认不设置) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setGroupAddRequest
```php
public function setGroupAddRequest(array|int|string $flag, string $sub_type, bool $approve, string $reason): array|bool
```
### 描述
处理加群请求/邀请
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| flag | array|int|string | 处理加群请求的flag |
| sub_type | string | 处理请求类型包含add和invite |
| approve | bool | 是否同意默认为true |
| reason | string | 拒绝理由(仅在拒绝时有效,默认为空) |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getLoginInfo
```php
public function getLoginInfo(): array|bool
```
### 描述
获取登录号信息
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getStrangerInfo
```php
public function getStrangerInfo(int|string $user_id, bool $no_cache): array|bool
```
### 描述
获取陌生人信息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| user_id | int|string | 用户ID |
| no_cache | bool | 是否不使用缓存默认为false |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getFriendList
```php
public function getFriendList(): array|bool
```
### 描述
获取好友列表
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGroupInfo
```php
public function getGroupInfo(int|string $group_id, bool $no_cache): array|bool
```
### 描述
获取群信息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| no_cache | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGroupList
```php
public function getGroupList(): array|bool
```
### 描述
获取群列表
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGroupMemberInfo
```php
public function getGroupMemberInfo(int|string $group_id, int|string $user_id, bool $no_cache): array|bool
```
### 描述
获取群成员信息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| user_id | int|string | 用户ID |
| no_cache | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGroupMemberList
```php
public function getGroupMemberList(int|string $group_id): array|bool
```
### 描述
获取群成员列表
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getGroupHonorInfo
```php
public function getGroupHonorInfo(int|string $group_id, string $type): array|bool
```
### 描述
获取群荣誉信息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| group_id | int|string | 群ID |
| type | string | 荣誉类型 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getCsrfToken
```php
public function getCsrfToken(): array|bool
```
### 描述
获取 CSRF Token
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getCredentials
```php
public function getCredentials(string $domain): array|bool
```
### 描述
获取 QQ 相关接口凭证
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| domain | string | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getRecord
```php
public function getRecord(string $file, string $out_format): array|bool
```
### 描述
获取语音
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| file | string | 文件 |
| out_format | string | 输出格式 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getImage
```php
public function getImage(string $file): array|bool
```
### 描述
获取图片
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| file | string | 文件 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## canSendImage
```php
public function canSendImage(): array|bool
```
### 描述
检查是否可以发送图片
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## canSendRecord
```php
public function canSendRecord(): array|bool
```
### 描述
检查是否可以发送语音
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getStatus
```php
public function getStatus(): array|bool
```
### 描述
获取运行状态
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getVersionInfo
```php
public function getVersionInfo(): array|bool
```
### 描述
获取版本信息
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## setRestart
```php
public function setRestart(int $delay): array|bool
```
### 描述
重启 OneBot 实现
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| delay | int | 延迟时间毫秒默认为0 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## cleanCache
```php
public function cleanCache(): array|bool
```
### 描述
清理缓存
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |
## getExtendedAPI
```php
public function getExtendedAPI(string $package_name): mixed
```
### 描述
获取内置支持的扩展API对象
现支持 go-cqhttp 的扩展API
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| package_name | string | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | 返回包的操作对象 |
## callExtendedAPI
```php
public function callExtendedAPI(string $action, array $params): array|bool
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| action | string | 动作API名称 |
| params | array | 参数 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array|bool | 返回API调用结果数组或异步API调用状态bool |

View File

@@ -0,0 +1,117 @@
# ZM\API\Proxies\Bot\AbstractBotProxy
## __construct
```php
public function __construct(AbstractBotProxy|ZMRobot $bot): mixed
```
### 描述
构造函数
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| bot | AbstractBotProxy|ZMRobot | 调用此代理的机器人实例 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## __call
```php
public function __call(string $name, array $arguments): mixed
```
### 描述
在传入的机器人实例上调用方法
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| name | string | 方法名 |
| arguments | array | 参数 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## __get
```php
public function __get(string $name): mixed
```
### 描述
获取传入的机器人实例的属性
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| name | string | 属性名 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## __set
```php
public function __set(string $name, mixed $value): mixed
```
### 描述
设置传入的机器人实例的属性
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| name | string | 属性名 |
| value | mixed | 属性值 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## __isset
```php
public function __isset(string $name): bool
```
### 描述
判断传入的机器人实例的属性是否存在
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| name | string | 属性名 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| bool | |

View File

@@ -0,0 +1,24 @@
# ZM\API\Proxies\Bot\AllBotsProxy
## __call
```php
public function __call(string $name, array $arguments): array<mixed>
```
### 描述
在所有机器人实例上调用方法
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| name | string | 方法名 |
| arguments | array | 参数 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array<mixed> | 返回一个包含所有执行结果的数组键名为机器人ID |

View File

@@ -0,0 +1,24 @@
# ZM\API\Proxies\Bot\AllGroupsProxy
## __call
```php
public function __call(string $name, array $arguments): array<mixed>
```
### 描述
在传入的机器人实例上调用方法
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| name | string | 方法名 |
| arguments | array | 参数 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array<mixed> | 返回一个包含所有执行结果的数组,键名为群号 |

View File

@@ -0,0 +1,48 @@
# ZM\API\TuringAPI
## getTuringMsg
```php
public function getTuringMsg(string $msg, int|string $user_id, string $api): string
```
### 描述
请求图灵API返回图灵的消息
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| msg | string | 消息 |
| user_id | int|string | 用户ID |
| api | string | API Key |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | 图灵的回复 |
## getResultStatus
```php
public function getResultStatus(array $r): bool|string
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| r | array | 数据API回包 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| bool|string | 错误消息或成功鸥鸟 |

View File

@@ -0,0 +1,46 @@
# ZM\API\ZMRobot
## all
```php
public function all(ZM\API\Proxies\Bot\AbstractBotProxy $proxy): ZM\API\Proxies\Bot\AllBotsProxy
```
### 描述
获取一个会在所有机器人实例上执行的代理
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| proxy | ZM\API\Proxies\Bot\AbstractBotProxy | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZM\API\Proxies\Bot\AllBotsProxy | |
## allGroups
```php
public function allGroups(ZM\API\Proxies\Bot\AbstractBotProxy $proxy): ZM\API\Proxies\Bot\AllGroupsProxy
```
### 描述
获取一个会在所有群上执行的代理
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| proxy | ZM\API\Proxies\Bot\AbstractBotProxy | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZM\API\Proxies\Bot\AllGroupsProxy | |

View File

@@ -0,0 +1,293 @@
# ZM\Adapters\OneBot11Adapter
## getName
```php
public function getName(): string
```
### 描述
{@inheritDoc}
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | |
## getVersion
```php
public function getVersion(): string
```
### 描述
{@inheritDoc}
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | |
## handleIncomingRequest
```php
public function handleIncomingRequest(ZM\Context\ContextInterface $context): void
```
### 描述
{@inheritDoc}
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| context | ZM\Context\ContextInterface | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## handleAPIResponse
```php
public function handleAPIResponse(array $data, ContextInterface $context): void
```
### 描述
处理 API 响应
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | 数据 |
| context | ContextInterface | 上下文 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## handleMessageEvent
```php
public function handleMessageEvent(array $data, ContextInterface $context): void
```
### 描述
处理消息事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | 消息数据 |
| context | ContextInterface | 上下文 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## handleMetaEvent
```php
public function handleMetaEvent(array $data, ContextInterface $context): void
```
### 描述
处理元事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | 消息数据 |
| context | ContextInterface | 上下文 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## handleNoticeEvent
```php
public function handleNoticeEvent(array $data, ContextInterface $context): void
```
### 描述
处理通知事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | 消息数据 |
| context | ContextInterface | 上下文 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## handleRequestEvent
```php
public function handleRequestEvent(array $data, ContextInterface $context): void
```
### 描述
处理请求事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | 消息数据 |
| context | ContextInterface | 上下文 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## handleBeforeEvent
```php
public function handleBeforeEvent(array $data, string $time): ZM\Event\EventDispatcher
```
### 描述
处理前置事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | 消息数据 |
| time | string | 执行时机 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZM\Event\EventDispatcher | |
## handleAfterEvent
```php
public function handleAfterEvent(array $data): ZM\Event\EventDispatcher
```
### 描述
处理后置事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | 消息数据 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZM\Event\EventDispatcher | |
## isAPIResponse
```php
public function isAPIResponse(array $data): bool
```
### 描述
判断是否为 API 回调
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| bool | |
## isEvent
```php
public function isEvent(array $data): bool
```
### 描述
判断是否为事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| bool | |
## isMetaEvent
```php
public function isMetaEvent(array $data): bool
```
### 描述
判断是否为元事件
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| data | array | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| bool | |

View File

@@ -0,0 +1,23 @@
# ZM\Annotation\AnnotationBase
## on
```php
public function on(mixed $method): ZM\Annotation\AnnotationBase
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| method | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZM\Annotation\AnnotationBase | |

View File

@@ -0,0 +1,174 @@
# ZM\Annotation\AnnotationHandler
## __construct
```php
public function __construct(string $annotation_class): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| annotation_class | string | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## interrupt
```php
public function interrupt(mixed $return_var): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| return_var | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## setRuleCallback
```php
public function setRuleCallback(callable $rule): ZM\Annotation\AnnotationHandler
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| rule | callable | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZM\Annotation\AnnotationHandler | |
## setReturnCallback
```php
public function setReturnCallback(callable $return): ZM\Annotation\AnnotationHandler
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| return | callable | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| ZM\Annotation\AnnotationHandler | |
## handleAll
```php
public function handleAll(mixed $params): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| params | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## handle
```php
public function handle(ZM\Annotation\AnnotationBase $v, callable $rule_callback, mixed $args): bool
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| v | ZM\Annotation\AnnotationBase | |
| rule_callback | callable | |
| args | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| bool | |
## getStatus
```php
public function getStatus(): int
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | |
## getReturnVal
```php
public function getReturnVal(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,40 @@
# ZM\Annotation\AnnotationMap
## loadAnnotationByParser
```php
public function loadAnnotationByParser(ZM\Annotation\AnnotationParser $parser): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| parser | ZM\Annotation\AnnotationParser | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## sortAnnotationList
```php
public function sortAnnotationList(): void
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |

View File

@@ -0,0 +1,163 @@
# ZM\Annotation\AnnotationParser
## __construct
```php
public function __construct(bool $with_internal_parsers): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| with_internal_parsers | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## addSpecialParser
```php
public function addSpecialParser(string $class_name, callable $callback): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| class_name | string | |
| callback | callable | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## parseAll
```php
public function parseAll(): void
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## generateAnnotationList
```php
public function generateAnnotationList(): array
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array | |
## addRegisterPath
```php
public function addRegisterPath(string $path, string $indoor_name): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| path | string | |
| indoor_name | string | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## getUsedTime
```php
public function getUsedTime(): float
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| float | |
## getAnnotationMap
```php
public function getAnnotationMap(): array
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array | |
## addRouteAnnotation
```php
public function addRouteAnnotation(ZM\Annotation\Http\Route $vss, array $same_method_annotations): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| vss | ZM\Annotation\Http\Route | |
| same_method_annotations | array | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1 @@
# ZM\Annotation\CQ\CQAPIResponse

View File

@@ -0,0 +1,39 @@
# ZM\Annotation\CQ\CQAfter
## getLevel
```php
public function getLevel(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## setLevel
```php
public function setLevel(mixed $level): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| level | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,39 @@
# ZM\Annotation\CQ\CQBefore
## getLevel
```php
public function getLevel(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## setLevel
```php
public function setLevel(mixed $level): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| level | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,22 @@
# ZM\Annotation\CQ\CQCommand
## setLevel
```php
public function setLevel(int $level): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| level | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1 @@
# ZM\Annotation\CQ\CQMessage

View File

@@ -0,0 +1,39 @@
# ZM\Annotation\CQ\CQMetaEvent
## getLevel
```php
public function getLevel(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## setLevel
```php
public function setLevel(int $level): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| level | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,22 @@
# ZM\Annotation\CQ\CQNotice
## setLevel
```php
public function setLevel(int $level): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| level | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,22 @@
# ZM\Annotation\CQ\CQRequest
## setLevel
```php
public function setLevel(int $level): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| level | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1 @@
# ZM\Annotation\Command\TerminalCommand

View File

@@ -0,0 +1,61 @@
# ZM\Annotation\Cron\Cron
## setStatus
```php
public function setStatus(int $status): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| status | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## getRecordNextTime
```php
public function getRecordNextTime(): int
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | |
## setRecordNextTime
```php
public function setRecordNextTime(int $record_next_time): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| record_next_time | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\Controller

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\HandleAfter

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\HandleBefore

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\HandleException

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\Middleware

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\MiddlewareClass

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\RequestMapping

View File

@@ -0,0 +1 @@
# ZM\Annotation\Http\RequestMethod

View File

@@ -0,0 +1 @@
# ZM\Annotation\Module\Closed

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnCloseEvent

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnManagerStartEvent

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnMessageEvent

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnOpenEvent

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnPipeMessageEvent

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnRequestEvent

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnSave

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnSetup

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnStart

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnSwooleEvent

View File

@@ -0,0 +1,23 @@
# ZM\Annotation\Swoole\OnSwooleEventBase
## setLevel
```php
public function setLevel(int $level): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| level | int | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,17 @@
# ZM\Annotation\Swoole\OnTask
## getRule
```php
public function getRule(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnTaskEvent

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\OnTick

View File

@@ -0,0 +1 @@
# ZM\Annotation\Swoole\SwooleHandler

View File

@@ -0,0 +1,17 @@
# ZM\Command\BuildCommand
## configure
```php
public function configure(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,24 @@
# ZM\Command\CheckConfigCommand
## check
```php
public function check(mixed $remote, mixed $local): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| remote | mixed | |
| local | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1,226 @@
# ZM\Command\Command
## execute
```php
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| input | Symfony\Component\Console\Input\InputInterface | |
| output | Symfony\Component\Console\Output\OutputInterface | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | |
## shouldExecute
```php
public function shouldExecute(): bool
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| bool | |
## handle
```php
public function handle(): int
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | |
## write
```php
public function write(string $message, bool $newline): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message | string | |
| newline | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## info
```php
public function info(string $message, bool $newline): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message | string | |
| newline | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## error
```php
public function error(string $message, bool $newline): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message | string | |
| newline | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## comment
```php
public function comment(string $message, bool $newline): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message | string | |
| newline | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## question
```php
public function question(string $message, bool $newline): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message | string | |
| newline | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## detail
```php
public function detail(string $message, bool $newline): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message | string | |
| newline | bool | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## section
```php
public function section(string $message, callable $callback): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| message | string | |
| callback | callable | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |

View File

@@ -0,0 +1 @@
# ZM\Command\Daemon\DaemonCommand

View File

@@ -0,0 +1 @@
# ZM\Command\Daemon\DaemonReloadCommand

View File

@@ -0,0 +1 @@
# ZM\Command\Daemon\DaemonStatusCommand

View File

@@ -0,0 +1 @@
# ZM\Command\Daemon\DaemonStopCommand

View File

@@ -0,0 +1,91 @@
# ZM\Command\Generate\APIDocsGenerateCommand
## configure
```php
public function configure(): void
```
### 描述
Configures the current command.
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## execute
```php
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
```
### 描述
Executes the current command.
This method is not abstract because you can use this class
as a concrete class. In this case, instead of defining the
execute() method, you set the code to execute by passing
a Closure to the setCode() method.
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| input | Symfony\Component\Console\Input\InputInterface | |
| output | Symfony\Component\Console\Output\OutputInterface | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | 0 if everything went fine, or an exit code * |
## getClassMetas
```php
public function getClassMetas(string $class_name, Jasny\PhpdocParser\PhpdocParser $parser): array
```
### 描述
获取类的元数据
包括类的注释、方法的注释、参数、返回值等
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| class_name | string | |
| parser | Jasny\PhpdocParser\PhpdocParser | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| array | |
## convertMetaToMarkdown
```php
public function convertMetaToMarkdown(string $method, array $meta): string
```
### 描述
将方法的元数据转换为 Markdown 格式
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| method | string | 方法名 |
| meta | array | 元数据 |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| string | |

View File

@@ -0,0 +1 @@
# ZM\Command\Generate\SystemdGenerateCommand

View File

@@ -0,0 +1,40 @@
# ZM\Command\InitCommand
## setBasePath
```php
public function setBasePath(): void
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |
## extractFile
```php
public function extractFile(string $file): void
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| file | string | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| void | |

View File

@@ -0,0 +1,24 @@
# ZM\Command\Module\ModuleListCommand
## execute
```php
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| input | Symfony\Component\Console\Input\InputInterface | |
| output | Symfony\Component\Console\Output\OutputInterface | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | |

View File

@@ -0,0 +1,24 @@
# ZM\Command\Module\ModulePackCommand
## execute
```php
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| input | Symfony\Component\Console\Input\InputInterface | |
| output | Symfony\Component\Console\Output\OutputInterface | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | |

View File

@@ -0,0 +1 @@
# ZM\Command\Module\ModuleUnpackCommand

View File

@@ -0,0 +1,41 @@
# ZM\Command\ProxyServerCommand
## configure
```php
public function configure(): mixed
```
### 描述
作者很懒,什么也没有说
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |
## startSocksProxy
```php
public function startSocksProxy(string $address, mixed $port): mixed
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| address | string | |
| port | mixed | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| mixed | |

View File

@@ -0,0 +1 @@
# ZM\Command\PureHttpCommand

View File

@@ -0,0 +1 @@
# ZM\Command\RunServerCommand

View File

@@ -0,0 +1,24 @@
# ZM\Command\Server\ServerCommand
## execute
```php
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
```
### 描述
作者很懒,什么也没有说
### 参数
| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| input | Symfony\Component\Console\Input\InputInterface | |
| output | Symfony\Component\Console\Output\OutputInterface | |
### 返回
| 类型 | 描述 |
| ---- | ----------- |
| int | |

View File

@@ -0,0 +1 @@
# ZM\Command\Server\ServerReloadCommand

Some files were not shown because too many files have changed in this diff Show More