webman
Expert skill for the webman framework (a long-lived, in-memory PHP framework based on workerman). Covers routing, controllers, middleware, database/Redis, custom processes, timers, coroutines (v2), plugin development, and guarding against memory leaks and cross-request state pollution under the resident process model. Use when the project has start.php, config/process.php, or support/bootstrap.php, or when the user mentions webman, workerman, 常驻内存 PHP, 协程 PHP, or long-lived/in-memory PHP.
How do I install this agent skill?
npx skills add https://github.com/zjkal/webman-skill --skill webmanIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides a comprehensive set of instructions and reference documentation for developing applications with the webman PHP framework. It focuses on teaching the AI agent how to handle the framework's resident-memory model, routing, database interactions, and coroutines safely and efficiently. No security risks or malicious behaviors were identified.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
webman Framework Development
webman is a high-performance, long-lived in-memory PHP framework built on workerman. Unlike PHP-FPM (bootstrap per request, tear down after response), correct webman code starts from understanding the resident-process model.
Core Mental Model: Resident Memory
After startup, a worker stays in memory and handles thousands of requests. Hard rules that follow:
- Never
exit/die: they kill the whole worker and drop every connection on that process. - Static properties / globals survive across requests: data written by the
previous request can "leak" into the next. Keep request-scoped data in local
variables,
$requestattributes, orsupport\Contextunder coroutines. - Singletons are shared across requests: do not store request state on singletons; array properties that only grow are memory leaks.
- Code changes need reload/restart (
php start.php reload). In debug mode,status/connectionshelp diagnose issues. - Controllers are new per request by default (
controller_reuse => falseinconfig/app.php). If reuse is enabled, controller properties also survive across requests.
Project Layout
├── app/ # Application code
│ ├── controller/ # Controllers (optional; MVC or DDD as you prefer)
│ ├── model/ # Models
│ ├── middleware/ # Middleware
│ └── functions.php # Custom helpers
├── config/ # All configuration
│ ├── route.php # Routes
│ ├── process.php # Process definitions (HTTP, custom, timers)
│ ├── middleware.php # Middleware registration
│ ├── database.php # Database (illuminate/database)
│ ├── redis.php # Redis
│ └── plugin/ # Plugin config
├── plugin/ # Application plugins
├── public/ # Static assets (only web-accessible directory)
├── process/ # Custom process classes
├── support/ # Framework bridge code
└── start.php # Entry point
Common Commands
composer create-project workerman/webman # create project
# Linux / macOS
php start.php start # foreground (debug)
php start.php start -d # daemon (production)
php start.php reload # graceful reload (code updates, keep connections)
php start.php restart -d # full restart (required after process.php, Timer, or resident data changes)
php start.php stop
php start.php status # process memory, request counts
php start.php connections # connection info
# Windows (no daemon / reload)
php windows.php
reload vs restart: reload only reloads app code (app/ and most of
config/). Changes to config/process.php or timers/connections already
created in onWorkerStart are not reloaded — use restart.
Coding Conventions
- PHP >= 8.0 (webman v2 requires 8.1+); always
declare(strict_types=1). - Controller signatures:
public function action(Request $request): Response, withsupport\Request. - Return
Webman\Http\Responsevia helpers (response(),json(),view(),redirect(), …). Do notecho. - Prefer
illuminate/database(Db::table()/ Eloquent models extendingsupport\Model). - Read config with
config('app.debug'); neverincludeconfig files. - Log with
support\Log(Log::info()/Log::channel('xx')->info()), noterror_logorecho.
Do / Don't Cheatsheet
| Don't | Do |
|---|---|
exit() / die() to end a request | return response(...) or throw |
$_GET / $_POST / $_SESSION | $request->get() / $request->post() / $request->session() |
header() / setcookie() | $response->header() / $response->cookie() |
| Unbounded static arrays | Bounded cache (LRU) or Redis |
| Request data on singletons | Locals / support\Context (coroutines) |
| Timers created per request in app code | Custom process in config/process.php |
| Static vars for request state under coroutines | support\Context::set() / get() |
References (read on demand)
- Routing, controllers, request/response APIs: references/routing-controller.md
- Middleware (onion model, CORS, auth): references/middleware.md
- Database, Redis, cache, pagination, transactions: references/database-redis.md
- Custom processes, WebSocket/TCP, timers: references/custom-process.md
- Coroutines (webman v2), Context, concurrency, pools: references/coroutine.md
- Lifecycle, memory leaks, prevention: references/memory-lifecycle.md
- Plugin development (library vs app plugins): references/plugin.md
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/zjkal/webman-skill/webman">View webman on skillZs</a>