feat(webman): 初始化webman框架基础配置与核心代码

- 添加基础配置文件,包括app、autoload、bootstrap、container、database、dependence、exception、log、middleware
- 新增完整Dockerfile和docker-compose.yml,支持容器化运行
- 增加webman控制台插件配置及依赖管理文件composer.json
- 创建app目录下核心控制器IndexController及进程Http和Monitor
- 实现日志工具类Logger,支持多级别及异常格式化
- 配置.gitignore优化忽略无关文件和目录
- 初始化.idea项目配置文件,支持开发环境集成
- 完善启动流程,支持自动加载配置、路由及中间件
- 增加文件变更监控和内存监控机制,提升开发体验
- 设定默认时区为Asia/Shanghai,开启调试模式
- 配置日志输出格式,支持多种日志处理器与颜色高亮
- 提供公共函数文件框架,便于扩展自定义功能
This commit is contained in:
zimoyin
2026-03-02 21:55:33 +08:00
commit 043306819b
48 changed files with 8550 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace app\process;
use app\utils\Logger;
use support\Log;
use Workerman\Connection\TcpConnection;
class TcpServer
{
public function onWorkerStart($worker)
{
Logger::debug("TcpServer start");
Log::info("TcpServer start");
Log::warning("TcpServer start");
Log::error("TcpServer start");
Logger::new('Test')->warning("TcpServer start");
}
// 连接
public function onConnect(TcpConnection $connection)
{
$connection->send('Hello ' . $connection->getRemoteIp());
Log::info("客户端链接到主机: {$connection->getRemoteIp()}");
}
// 接收数据
public function onMessage(TcpConnection $connection, $data)
{
$connection->send('Server: ' . $data);
}
// 连接关闭
public function onClose(TcpConnection $connection)
{
echo "Connection closed\n";
}
}