— No reviews yet
0 installs
9 views
0.0% view→install
Install
$ agentstack add skill-fanqingxuan-awesome-skills-webman ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Are you the author of Webman? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claimAbout
Webman 开发指南
Webman 高性能 PHP 框架开发助手,专注于控制器、模型、路由、中间件的快速开发。
常用命令
# 启动服务
php start.php start
# 调试模式启动(前台运行)
php start.php start -d
# 守护进程模式启动
php start.php start -d
# 停止服务
php start.php stop
# 重启服务
php start.php restart
# 平滑重启(不中断服务)
php start.php reload
# 平滑停止
php start.php stop -g
# 查看状态
php start.php status
# 查看连接状态
php start.php connections
# 创建控制器
php webman make:controller UserController
# 创建模型
php webman make:model User
# 创建中间件
php webman make:middleware AuthMiddleware
# 数据库迁移
php webman migrate
# 清除缓存
php webman cache:clear
快速示例
控制器
0, 'data' => []]);
}
public function show(Request $request, $id)
{
return json(['code' => 0, 'data' => ['id' => $id]]);
}
}
服务类
update($data) : false;
}
public function delete(int $id): bool
{
$user = User::find($id);
return $user ? $user->delete() : false;
}
}
验证器
'require|max:25',
'email' => 'require|email',
];
protected $message = [
'name.require' => '名称必须',
'email.require' => '邮箱必须',
'email.email' => '邮箱格式错误',
];
}
目录结构
app/
├── controller/ # 控制器
├── model/ # 模型
├── middleware/ # 中间件
├── service/ # 服务层
├── validate/ # 验证器
└── view/ # 视图
config/
├── app.php # 应用配置
├── database.php # 数据库配置
├── route.php # 路由配置
└── middleware.php # 中间件配置
内存泄漏注意事项
Webman 是常驻内存框架,需要注意避免内存泄漏。以下是需要避免的做法:
避免使用无限膨胀的 static 数组
// ❌ 错误示例 - 会导致内存泄漏
class Foo
{
public static $data = [];
public function index(Request $request)
{
self::$data[] = time(); // 数组无限增长
return response('hello');
}
}
// ✅ 正确做法 - 使用局部变量
class Foo
{
public function index(Request $request)
{
$data = []; // 请求结束后自动回收
$data[] = time();
return response('hello');
}
}
避免单例中的无限膨胀数组
// ❌ 错误示例 - 单例中的数组无限增长
class Cache
{
protected static $instance;
public $data = [];
public static function instance()
{
if (!self::$instance) {
self::$instance = new self;
}
return self::$instance;
}
public function set($key, $value)
{
$this->data[$key] = $value; // key 无限增长会泄漏
}
}
// ✅ 正确做法 - 限制数组大小或使用 Redis
class Cache
{
protected static $instance;
public $data = [];
private $maxSize = 1000;
public function set($key, $value)
{
if (count($this->data) >= $this->maxSize) {
array_shift($this->data); // 移除最旧的元素
}
$this->data[$key] = $value;
}
}
避免使用 global 关键字的数组
// ❌ 错误示例
class Index
{
public function index(Request $request)
{
global $data;
$data[] = time(); // 全局数组无限增长
return response('hello');
}
}
// ✅ 正确做法 - 使用依赖注入或容器
class Index
{
public function index(Request $request)
{
$data = $request->get('data', []);
return response('hello');
}
}
内存泄漏规避建议
- 尽量不使用
global、static关键字的数组,如果使用确保其不会无限膨胀 - 对于不熟悉的类,尽量不使用单例,用
new关键字初始化 - 如果需要单例,检查其是否有无限膨胀的数组属性
- 使用 Redis/Memcached 等外部缓存替代内存缓存
- 定期清理数据,为长生命周期的数组设置大小限制
> 提示: webman 自带的 monitor 进程会监控内存使用,当内存即将达到 memory_limit 时会自动安全重启进程。
官方文档参考
详细文档请参考 references/ 目录下的官方文档。
路由配置
session()->get('user_id')) {
return json(['code' => 401, 'msg' => 'Unauthorized']);
}
return $handler($request);
}
}
## Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [fanqingxuan](https://github.com/fanqingxuan)
- **Source:** [fanqingxuan/awesome-skills](https://github.com/fanqingxuan/awesome-skills)
- **License:** MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.