
Php Pro
Implement modern PHP backends with strict typing, Swoole servers, and coroutine concurrency when a solo builder needs API performance beyond traditional request-per-process hosting.
Overview
PHP Pro is an agent skill for the Build phase that applies advanced PHP patterns including Swoole HTTP servers and coroutine concurrency for APIs.
Install
npx skills add https://github.com/jeffallan/claude-skills --skill php-proWhat is this skill?
- Swoole HTTP server bootstrap with worker_num, task workers, and coroutines enabled
- JSON API routing via match on request URI with structured 404 handling
- Coroutine-based concurrent HTTP client patterns with WaitGroup
- declare(strict_types=1) throughout example server code
- Health endpoint pattern for operability checks
- Example server configures 4 workers and 2 task workers
Adoption & trust: 10.5k installs on skills.sh; 9.7k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your PHP API bottlenecks on sequential I/O and you need a concrete async server pattern instead of copying fragmented Swoole snippets.
Who is it for?
Indie builders comfortable with PHP 8+ who are deploying or prototyping Swoole-backed services and want agent-guided server and coroutine structure.
Skip if: Beginners on shared hosting only, pure Laravel blade apps with no custom runtime, or teams that cannot run Swoole extensions in production.
When should I use this skill?
Implementing or extending PHP backends with Swoole HTTP servers, coroutines, or async I/O for APIs.
What do I get? / Deliverables
You get strict-typed Swoole server and coroutine templates you can adapt for routed JSON APIs and parallel backend calls.
- Swoole HTTP server skeleton
- Routed API handler examples
- Coroutine concurrent request pattern
Recommended Skills
Journey fit
Async PHP and HTTP server patterns belong in Build when you are implementing APIs and server runtime behavior. Backend subphase covers long-lived servers, routing, and database access—the focus of the Swoole examples in the skill body.
How it compares
Skill package for Swoole-centric PHP APIs—not a drop-in substitute for Laravel application skills or managed serverless PHP.
Common Questions / FAQ
Who is php-pro for?
Solo developers and small teams building PHP APIs who want Swoole async server and coroutine guidance inside Claude or Cursor sessions.
When should I use php-pro?
Use it during Build backend work when implementing or hardening JSON APIs, health checks, or concurrent outbound HTTP from a Swoole server.
Is php-pro safe to install?
Treat it like any code-generating skill: review the Security Audits panel on this page and audit generated server code before exposing it to the internet.
SKILL.md
READMESKILL.md - Php Pro
# Async PHP Patterns ## Swoole HTTP Server ```php <?php declare(strict_types=1); use Swoole\HTTP\Server; use Swoole\HTTP\Request; use Swoole\HTTP\Response; $server = new Server('0.0.0.0', 9501); $server->set([ 'worker_num' => 4, 'max_request' => 10000, 'task_worker_num' => 2, 'enable_coroutine' => true, ]); $server->on('start', function (Server $server) { echo "Swoole HTTP server started at http://0.0.0.0:9501\n"; }); $server->on('request', function (Request $request, Response $response) { $response->header('Content-Type', 'application/json'); match ($request->server['request_uri']) { '/api/users' => handleUsers($request, $response), '/api/health' => $response->end(json_encode(['status' => 'healthy'])), default => $response->status(404)->end(json_encode(['error' => 'Not found'])), }; }); function handleUsers(Request $request, Response $response): void { // Coroutine for concurrent DB queries go(function () use ($response) { $users = queryDatabase('SELECT * FROM users LIMIT 10'); $response->end(json_encode(['data' => $users])); }); } $server->start(); ``` ## Swoole Coroutines ```php <?php declare(strict_types=1); use Swoole\Coroutine; use Swoole\Coroutine\Http\Client; // Concurrent HTTP requests Coroutine\run(function () { $results = []; // Create multiple coroutines $wg = new Coroutine\WaitGroup(); $urls = [ 'https://api.example.com/users', 'https://api.example.com/posts', 'https://api.example.com/comments', ]; foreach ($urls as $url) { $wg->add(); go(function () use ($url, &$results, $wg) { $client = new Client(parse_url($url, PHP_URL_HOST), 443, true); $client->set(['timeout' => 5]); $client->get(parse_url($url, PHP_URL_PATH)); $results[$url] = [ 'status' => $client->statusCode, 'body' => $client->body, ]; $client->close(); $wg->done(); }); } $wg->wait(); print_r($results); }); ``` ## Swoole Async MySQL ```php <?php declare(strict_types=1); use Swoole\Coroutine; use Swoole\Coroutine\MySQL; Coroutine\run(function () { $mysql = new MySQL(); $connected = $mysql->connect([ 'host' => '127.0.0.1', 'port' => 3306, 'user' => 'root', 'password' => 'password', 'database' => 'test', ]); if (!$connected) { throw new \RuntimeException($mysql->connect_error); } // Async query $result = $mysql->query('SELECT * FROM users WHERE active = 1'); foreach ($result as $row) { echo "User: {$row['name']}\n"; } // Prepared statements $stmt = $mysql->prepare('SELECT * FROM users WHERE id = ?'); $stmt->execute([42]); $user = $stmt->fetchAll(); $mysql->close(); }); ``` ## Swoole Channel (Communication) ```php <?php declare(strict_types=1); use Swoole\Coroutine; use Swoole\Coroutine\Channel; Coroutine\run(function () { $channel = new Channel(10); // Buffer size: 10 // Producer go(function () use ($channel) { for ($i = 1; $i <= 5; $i++) { $channel->push("Task {$i}"); echo "Produced: Task {$i}\n"; Coroutine::sleep(0.5); } $channel->close(); }); // Consumer go(function () use ($channel) { while (true) { $task = $channel->pop(); if ($task === false && $channel->errCode === SWOOLE_CHANNEL_CLOSED) { break; } echo "Consumed: {$task}\n"; Coroutine::sleep(1); } }); }); ``` ## ReactPHP Event Loop ```php <?php declare(strict_types=1); require 'vendor/autoload.php'; use React\EventLoop\Loop; use React\Http\Message\Response; use Psr\Http\Message\ServerRequestInterface; // HTTP Server $server = new React\Http\HttpServer(function (ServerRequestInterface $req