zhamao-framework is a high-performance chatbot + web server development framework
Developer QQ group: 670821194 Click to join the group chat
If there are developers who are willing to work together to develop the framework itself, please submit a PR or Issue to participate in the development! If you have better ideas about the core design of the framework itself, you can set up a development team with the author (currently only 2 people) to participate in the development of the OneBot V12 ecosystem and the framework itself.
See the Projects column for related ongoing version tasks!
The Zhamao framework is written in PHP and is mainly oriented to API services and chat robots. It includes Websocket, HTTP and other monitoring and request libraries. The user code is modularized and various functions can be easily written using annotations.
The main purpose of the framework is HTTP server and robot building framework. Especially for chatbot message processing, it is more convenient and comprehensive. It provides numerous conversation mechanisms and internal calling mechanisms, and you can design your own plug-ins in various ways.
#[BotCommand('Hello')]public function hello(BotContext $ctx) { $ctx->reply("Hello, I'm Zha Mao!"); // Simple imperative reply} #[Route('/index')]public function index() { return "<h1>hello!</h1>"; // Rapid HTTP service development}
The framework currently supports direct operation in Linux, WSL, macOS, and Windows environments. For Linux and macOS environments, you can directly use the one-click installation script below.
If you want to install and deploy in other environments, you can use Docker to quickly deploy or manually install the environment and then install the framework. See the documentation for details.
# Linux, macOS next click to detect the PHP environment and install the framework bash <(curl -fsSL https://zhamao.xin/v3.sh)# Start the framework cd zhamao-v3 ./zhamao server
The one-click installation script also allows you to customize parameters, such as:
# The script will detect the system's PHP by default. If you want to skip the detection directly and install an independent PHP version, add this environment variable export ZM_NO_LOCAL_PHP="yes" # If the script installs an independent version of PHP, the default version is 8.1. If you want to use other version, add this environment variable to specify the version export ZM_DOWN_PHP_VERSION="8.2"# By default, the script will store the framework's `zhamao-app` in the current directory. Directory for installation. If you want to use another directory, add this environment variable export ZM_CUSTOM_DIR="my-custom-app"# The script will use the Alibaba Cloud domestic acceleration image for this project by default. If you want to use the packagist source, add this environment variable export ZM_COMPOSER_PACKAGIST="yes"# After executing the previous environment variables and then executing the one-click installation script, you can implement custom parameters! bash <(curl -fsSL https://zhamao.xin/v3.sh)
See the documentation for alternative installation methods.
View the document (self-built in China): https://framework.zhamao.xin/
Alternate link (foreign hosting): https://framework.zhamao.me/
Native support for multiple robot clients to connect simultaneously
Flexible annotation event binding mechanism, which can use Annotation and native Attribute annotations at the same time
A complete plug-in system, plug-ins can be written and packaged or distributed for use by others.
Written in a plug-in format, it can be freely combined with other Composer components, or can be written in a single file for process
Supports module packaging and hot loading, making it more convenient to share modules
Resident in memory, global cache variables can be used everywhere, providing a variety of caching solutions
Comes with MySQL, SQLite, Redis and other database connection pools
It is an HTTP server and WebSocket server, and you can build your own HTTP API interface.
Optional built-in PHP environment, no need to manually compile and install, by crazywhalecc/static-php-cli
If you find any problems during use, you can submit an Issue or Fork it yourself, modify it and submit a Pull Request.
Currently, the project is maintained by only two people, which consumes a lot of energy, so contributions to the framework are very welcome.
This project was developed in the author's spare time. If you find it useful, you may wish to make a donation. Your donation will give me more motivation to improve the plug-in. Thank you for your support!
We will use the donated funds for the server expenses of the Explosive Bot and framework documentation driven by this project. Donation list
If you don’t want to directly participate in the development of the framework, you can also share the modules you wrote to help improve the framework ecosystem.
The framework and SDK are the core framework open source parts of the Explosive Robot project. The Explosive Robot is a high-performance robot written by the author, which won the first prize in the National Computer Design Competition.
The author's explosive robot has been running stably for five years since the beginning of 2018 and continues to iterate.
You can submit an issue or join the group (670821194) for troubleshooting.
When updating the content of this project, please pay attention to GitHub updates in a timely manner. Please back up your plug-ins or project codes before updating.
The project framework is open source using the Apache-2.0 protocol, and the protocol must be followed when distributing or rewriting and modifying it. The project plug-in part (folders other than src/Globals
and src/ZM
folders) can be distributed and modified without complying with the Apache-2.0 protocol (declaration of copyright) when not referencing code within the framework.
Note : When you use AGPL-3.0
protocol robot software such as mirai to connect to the framework, using this framework requires you to redistribute the parts you wrote or modified using AGPL-3.0
protocol.
When contributing code, please keep the sensitive information in your global configuration file safe, and do not upload configuration files with personal information to websites such as GitHub.
Thanks to JetBrains for providing PhpStorm development tool support for this open source project:
Thanks to developer @sunxyw for some suggestions for standardizing project development.