--- id: Jeffallan/claude-skills/php-pro version: "90459d22" license: MIT install: manual updated: 2026-05-20 --- # php-pro — PHP Pro is a senior-level specialist for modern PHP development with Laravel, Symfony, and PHP 8.3+. It enforces strict typing, dependency injection, and PSR compliance while generating typed DTOs, services, controllers, and comprehensive tests. Every implementation passes PHPStan level 9 and PHPUnit/Pest coverage thresholds before delivery. Publisher: Jeffallan · Stars: 10759 · Updated: 2026-05-20 Install (manual): `git clone https://github.com/Jeffallan/claude-skills` ## 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 1. **Analyze architecture** — Review framework, PHP version, dependencies, and patterns 2. **Design models** — Create typed domain models, value objects, DTOs 3. **Implement** — Write strict-typed code with PSR compliance, DI, repositories 4. **Secure** — Add validation, authentication, XSS/SQL injection protection 5. **Verify** — Run `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. ## 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 users->create([ 'name' => $dto->name, 'email' => $dto->email, 'password' => Hash::make($dto->password), ]); } } ``` ### PHPUnit Test Structure ```php 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 'Active', self::Inactive => 'Inactive', self::Banned => 'Banned', }; } } ``` ## Output Templates When implementing a feature, deliver in this order: 1. Domain models (entities, value objects, enums) 2. Service/repository classes 3. Controller/API endpoints 4. Test files (PHPUnit/Pest) 5. 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 [Documentation](https://jeffallan.github.io/claude-skills/skills/language/php-pro/) [View on SkillFed](https://skillfed.io/Jeffallan/claude-skills/php-pro) · [View on GitHub](https://github.com/Jeffallan/claude-skills)