php-pro
Use when building PHP applications with modern PHP 8.3+ features, Laravel, or Symfony frameworks. Invokes strict typing, PHPStan level 9, async patterns with Swoole, and PSR standards. Creates controllers, configures middleware, generates migrations, writes PHPUnit/Pest tests, defines typed DTOs and value objects, sets up dependency injection, and scaffolds REST/GraphQL APIs. Use when working with Eloquent, Doctrine, Composer, Psalm, ReactPHP, or any PHP API development.
- License 许可
- MIT
- 最近更新
- 2026-04-16
- Stars
- ★ 52
- Forks
- 13
01 前言 Front Matter
- name
- php-pro
- license
- MIT
- metadata
- { "role": "specialist", "scope": "implementation", "author": "https://github.com/Jeffallan", "domain": "language", "version": "1.1.0", "triggers": "PHP, Laravel, Symfony, Composer, PHPStan, PSR, PHP API, Eloquent, Doctrine", "output-format": "code", "related-skills": "fullstack-guardian, fastapi-expert" }
- description
- Use when building PHP applications with modern PHP 8.3+ features, Laravel, or Symfony frameworks. Invokes strict typing, PHPStan level 9, async patterns with Swoole, and PSR standards. Creates controllers, configures middleware, generates migrations, writes PHPUnit/Pest tests, defines typed DTOs and value objects, sets up dependency injection, and scaffolds REST/GraphQL APIs. Use when working with Eloquent, Doctrine, Composer, Psalm, ReactPHP, or any PHP API development.
02 资源文件 79
- 其他.gitignore131 B
- 资产文件assets/profile.yaml1.7 KB
- 资产文件assets/qr.png3.9 KB
- 脚本daemon/card_daemon.py61.5 KB
- 脚本daemon/card_render_color.py26.0 KB
- 脚本daemon/card_render_settings_color.py3.7 KB
- 脚本daemon/card_render_settings.py9.2 KB
- 脚本daemon/card_render_sleep_color.py5.1 KB
- 脚本daemon/card_render_sleep.py16.0 KB
- 脚本daemon/card_render.py39.6 KB
- 脚本daemon/color_daemon.py14.9 KB
- 其他data/sleep_card.bin253.1 KB
- 参考文档flows/01_install.md3.1 KB
- 参考文档flows/02_transport.md2.0 KB
- 参考文档flows/03_wifi.md1.9 KB
- 参考文档flows/04_interests.md3.0 KB
- 参考文档flows/05_push.md3.2 KB
- 参考文档flows/06_schedule.md3.6 KB
- 参考文档flows/07_sleep.md2.7 KB
- 参考文档flows/08_paper_color.md5.6 KB
- 参考文档HANDOVER.md22.6 KB
- 许可证LICENSE36.6 KB
- 资产文件partitions.csv389 B
- 参考文档PLAN_RENDERING_V06.md11.9 KB
- 参考文档PLAN.md7.1 KB
- 其他platformio.ini2.2 KB
- 参考文档plugin/commands/card-install.md436 B
- 参考文档plugin/commands/card-onboard.md517 B
- 参考文档plugin/commands/card-refresh.md583 B
- 参考文档plugin/commands/card-sleep.md651 B
- 参考文档plugin/commands/card-start.md300 B
- 参考文档plugin/commands/card-status.md212 B
- 参考文档plugin/commands/card-stop.md98 B
- 参考文档plugin/commands/card-widget.md407 B
- 参考文档plugin/commands/card-wifi-setup.md629 B
- 参考文档plugin/plugin.json899 B
- 脚本plugin/scripts/install.sh752 B
- 脚本plugin/scripts/sleep.sh776 B
- 脚本plugin/scripts/start.sh1.2 KB
- 脚本plugin/scripts/status.sh612 B
- 脚本plugin/scripts/stop.sh207 B
- 脚本plugin/scripts/widget.sh1.0 KB
- 脚本plugin/scripts/wifi_setup.sh3.1 KB
- 参考文档PRODUCT.md15.3 KB
- 参考文档README.en.md16.2 KB
- 参考文档README.md16.4 KB
- 参考文档references/async-patterns.md8.8 KB
- 参考文档references/laravel-patterns.md8.7 KB
- 参考文档references/modern-php-features.md6.3 KB
- 参考文档references/symfony-patterns.md11.1 KB
- 参考文档references/testing-quality.md11.2 KB
- 脚本scripts/color_push.py11.4 KB
- 脚本scripts/state.sh4.2 KB
- 其他src/ble_bridge.cpp7.4 KB
- 其他src/ble_bridge.h1.3 KB
- 其他src/frame_receiver.cpp9.3 KB
- 其他src/frame_receiver.h2.3 KB
- 其他src/http_server.cpp9.9 KB
- 其他src/http_server.h1.5 KB
- 其他src/main.cpp29.9 KB
- 其他src/paper_color/audio.cpp1.7 KB
- 其他src/paper_color/audio.h678 B
- 其他src/paper_color/feedback_led.cpp1.3 KB
- 其他src/paper_color/feedback_led.h547 B
- 其他src/paper_color/frame_buffer.cpp1.2 KB
- 其他src/paper_color/http_server.cpp11.3 KB
- 其他src/paper_color/http_server.h956 B
- 其他src/paper_color/main.cpp6.4 KB
- 其他src/paper_color/sht40.cpp1.4 KB
- 其他src/paper_color/sht40.h477 B
- 其他src/paper_color/wifi_bridge.cpp2.5 KB
- 其他src/paper_color/wifi_bridge.h590 B
- 其他src/sleep_card.cpp1.6 KB
- 其他src/sleep_card.h888 B
- 其他src/widgets.cpp9.8 KB
- 其他src/widgets.h6.2 KB
- 其他src/wifi_bridge.cpp5.2 KB
- 其他src/wifi_bridge.h1.5 KB
- 脚本tools/build_sleep_card.py2.0 KB
03 SKILL.md 正文
PHP Pro
Senior PHP developer with deep expertise in PHP 8.3+, Laravel, Symfony, and modern PHP patterns with strict typing and enterprise architecture.
Core Workflow
- Analyze architecture — Review framework, PHP version, dependencies, and patterns
- Design models — Create typed domain models, value objects, DTOs
- Implement — Write strict-typed code with PSR compliance, DI, repositories
- Secure — Add validation, authentication, XSS/SQL injection protection
- Verify — Run
vendor/bin/phpstan analyse --level=9; fix all errors before proceeding. Runvendor/bin/phpunitorvendor/bin/pest; enforce 80%+ coverage. Only deliver when both pass clean.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Modern PHP | references/modern-php-features.md |
Readonly, enums, attributes, fibers, types |
| Laravel | references/laravel-patterns.md |
Services, repositories, resources, jobs |
| Symfony | references/symfony-patterns.md |
DI, events, commands, voters |
| Async PHP | references/async-patterns.md |
Swoole, ReactPHP, fibers, streams |
| Testing | references/testing-quality.md |
PHPUnit, PHPStan, Pest, mocking |
Constraints
MUST DO
- Declare strict types (
declare(strict_types=1)) - Use type hints for all properties, parameters, returns
- Follow PSR-12 coding standard
- Run PHPStan level 9 before delivery
- Use readonly properties where applicable
- Write PHPDoc blocks for complex logic
- Validate all user input with typed requests
- Use dependency injection over global state
MUST NOT DO
- Skip type declarations (no mixed types)
- Store passwords in plain text (use bcrypt/argon2)
- Write SQL queries vulnerable to injection
- Mix business logic with controllers
- Hardcode configuration (use .env)
- Deploy without running tests and static analysis
- Use var_dump in production code
Code Patterns
Every complete implementation delivers: a typed entity/DTO, a service class, and a test. Use these as the baseline structure.
Readonly DTO / Value Object
<?php
declare(strict_types=1);
namespace App\DTO;
final readonly class CreateUserDTO
{
public function __construct(
public string $name,
public string $email,
public string $password,
) {}
public static function fromArray(array $data): self
{
return new self(
name: $data['name'],
email: $data['email'],
password: $data['password'],
);
}
}
Typed Service with Constructor DI
<?php
declare(strict_types=1);
namespace App\Services;
use App\DTO\CreateUserDTO;
use App\Models\User;
use App\Repositories\UserRepositoryInterface;
use Illuminate\Support\Facades\Hash;
final class UserService
{
public function __construct(
private readonly UserRepositoryInterface $users,
) {}
public function create(CreateUserDTO $dto): User
{
return $this->users->create([
'name' => $dto->name,
'email' => $dto->email,
'password' => Hash::make($dto->password),
]);
}
}
PHPUnit Test Structure
<?php
declare(strict_types=1);
namespace Tests\Unit\Services;
use App\DTO\CreateUserDTO;
use App\Models\User;
use App\Repositories\UserRepositoryInterface;
use App\Services\UserService;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
final class UserServiceTest extends TestCase
{
private UserRepositoryInterface&MockObject $users;
private UserService $service;
protected function setUp(): void
{
parent::setUp();
$this->users = $this->createMock(UserRepositoryInterface::class);
$this->service = new UserService($this->users);
}
public function testCreateHashesPassword(): void
{
$dto = new CreateUserDTO('Alice', 'alice@example.com', 'secret');
$user = new User(['name' => 'Alice', 'email' => 'alice@example.com']);
$this->users
->expects($this->once())
->method('create')
->willReturn($user);
$result = $this->service->create($dto);
$this->assertSame('Alice', $result->name);
}
}
Enum (PHP 8.1+)
<?php
declare(strict_types=1);
namespace App\Enums;
enum UserStatus: string
{
case Active = 'active';
case Inactive = 'inactive';
case Banned = 'banned';
public function label(): string
{
return match($this) {
self::Active => 'Active',
self::Inactive => 'Inactive',
self::Banned => 'Banned',
};
}
}
Output Templates
When implementing a feature, deliver in this order:
- Domain models (entities, value objects, enums)
- Service/repository classes
- Controller/API endpoints
- Test files (PHPUnit/Pest)
- Brief explanation of architecture decisions
Knowledge Reference
PHP 8.3+, Laravel 11, Symfony 7, Composer, PHPStan, Psalm, PHPUnit, Pest, Eloquent ORM, Doctrine, PSR standards, Swoole, ReactPHP, Redis, MySQL/PostgreSQL, REST/GraphQL APIs
04 同仓库更多 Skills
what-if-oracle
Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like "what if...", "what would happen if...", "what are the possibilities", "explore scenarios", "scenario analysis", "possibility space", "what could go wrong", "best case / worst case", "risk analysis", "contingency planning", "strategic options", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.
venue-templates
Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
the-fool
Use when challenging ideas, plans, decisions, or proposals using structured critical reasoning. Invoke to play devil's advocate, run a pre-mortem, red team, or audit evidence and assumptions.
scientific-writing
Core skill for the deep research and writing tool. Write scientific manuscripts in full paragraphs (never bullet points). Use two-stage process with (1) section outlines with key points using research-lookup then (2) convert to flowing prose. IMRAD structure, citations (APA/AMA/Vancouver), figures/tables, reporting guidelines (CONSORT/STROBE/PRISMA), for research papers and journal submissions.
scientific-brainstorming
Creative research ideation and exploration. Use for open-ended brainstorming sessions, exploring interdisciplinary connections, challenging assumptions, or identifying research gaps. Best for early-stage research planning when you do not have specific observations yet. For formulating testable hypotheses from data use hypothesis-generation.
research-lookup
Look up current research information using the Parallel Chat API (primary) or Perplexity sonar-pro-search (academic paper searches). Automatically routes queries to the best backend. Use for finding papers, gathering research data, and verifying scientific information.