php-pro by jeffallan/claude-skills
npx skills add https://github.com/jeffallan/claude-skills --skill php-pro资深 PHP 开发人员,精通 PHP 8.3+、Laravel、Symfony 以及采用严格类型和企业架构的现代 PHP 模式。
vendor/bin/phpstan analyse --level=9;在继续之前修复所有错误。运行 vendor/bin/phpunit 或 vendor/bin/pest;强制执行 80%+ 的覆盖率。仅在两者都通过时才交付。根据上下文加载详细指导:
| 主题 | 参考 | 加载时机 |
|---|---|---|
| 现代 PHP | references/modern-php-features.md |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 只读属性、枚举、属性、纤程、类型 |
| Laravel | references/laravel-patterns.md | 服务、仓库、资源、任务 |
| Symfony | references/symfony-patterns.md | 依赖注入、事件、命令、投票器 |
| 异步 PHP | references/async-patterns.md | Swoole、ReactPHP、纤程、流 |
| 测试 | references/testing-quality.md | PHPUnit、PHPStan、Pest、模拟 |
declare(strict_types=1))每个完整的实现应交付:一个类型化的实体/DTO、一个服务类和一个测试。将这些作为基础结构。
<?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'],
);
}
}
<?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),
]);
}
}
<?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);
}
}
<?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',
};
}
}
实现功能时,按此顺序交付:
PHP 8.3+, Laravel 11, Symfony 7, Composer, PHPStan, Psalm, PHPUnit, Pest, Eloquent ORM, Doctrine, PSR 标准, Swoole, ReactPHP, Redis, MySQL/PostgreSQL, REST/GraphQL APIs
每周安装量
4.0K
代码仓库
GitHub 星标
7.2K
首次出现
2026年1月21日
安全审计
安装于
claude-code2.9K
opencode2.1K
gemini-cli2.1K
codex2.1K
github-copilot2.0K
amp1.8K
Senior PHP developer with deep expertise in PHP 8.3+, Laravel, Symfony, and modern PHP patterns with strict typing and enterprise architecture.
vendor/bin/phpstan analyse --level=9; fix all errors before proceeding. Run vendor/bin/phpunit or vendor/bin/pest; enforce 80%+ coverage. Only deliver when both pass clean.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 |
declare(strict_types=1))Every complete implementation delivers: a typed entity/DTO, a service class, and a test. Use these as the baseline structure.
<?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'],
);
}
}
<?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),
]);
}
}
<?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);
}
}
<?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',
};
}
}
When implementing a feature, deliver in this order:
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
Weekly Installs
4.0K
Repository
GitHub Stars
7.2K
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code2.9K
opencode2.1K
gemini-cli2.1K
codex2.1K
github-copilot2.0K
amp1.8K
99,500 周安装