Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

php-pro — Claude Code skill: what it does, how to install

Enforces PHP 8.3+ standards across Laravel and Symfony projects with strict typing, PHPStan level 9 checks, and automated Pest tests.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Jeffallan/claude-skills --skill php-pro -a claude-code
Open on GitHub

What php-pro does

This skill guides the assistant through modern PHP development under PSR-12 standards. It enforces a strict implementation sequence: domain entities and readonly DTOs come first, followed by service classes with constructor dependency injection, API endpoints, and automated tests.

Code validation is tied to strict checks. The workflow requires running vendor/bin/phpstan analyse --level=9 to resolve every error and executing phpunit or pest with at least 80% test coverage before finishing work.

The mandatory PHPStan level 9 rule means the model will reject untyped arguments, mixed types, and global state. The skill also adapts patterns for Laravel 11, Symfony 7, and asynchronous architectures with Swoole or ReactPHP.

What it helps with

  • scaffold typed DTOs and value objects for PHP 8.3+
  • build service classes with constructor dependency injection
  • pass PHPStan static analysis at level 9 without errors
  • write PHPUnit or Pest test suites enforcing 80%+ coverage

Example prompts for the agent

  • Create a user registration service and DTO in Laravel with Pest tests
  • Build a Symfony 7 API controller using constructor dependency injection
  • Refactor this repository for PHPStan level 9 compliance and strict types

How to install php-pro

1Skills CLI (Vercel)

npx skills add Jeffallan/claude-skills --skill php-pro -a claude-code

2Manually: put the files in place

~/.claude/skills/php-pro/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/php-pro/

From the same set5

The whole set →

Similar

microservices-patterns Seth Hobson A practical guide to service boundaries, event-driven communication, data ownership, and resilience patterns for distributed systems. Claude Code CX Codex Cursor 13,176installs golang-uber-fx samber Skill for uber-go/fx — a dependency injection framework with lifecycle hooks, module system, and graceful shutdown. Useful if your project already uses fx or you're migrating to it for long-running services. Claude Code CX Codex Cursor +1 36,500installs langchain-architecture Seth Hobson This skill helps design LangChain 1.x and LangGraph applications with agents, memory, state, and tool calls. Use it for multi-step LLM workflows. Claude Code CX Codex Cursor 13,150installs protocol-reverse-engineering Dávid Balatoni This skill helps inspect network traffic, map protocol structures, and write protocol documentation. Use it for proprietary protocol analysis or network debugging. Claude Code CX Codex Cursor 12,701installs python-type-safety Seth Hobson Adds practical Python typing guidance for annotations, generics, protocols, type narrowing, and strict checks with mypy or pyright. Claude Code CX Codex Cursor 12,643installs workflow-orchestration-patterns Seth Hobson This skill helps design long-running Temporal workflows with clear workflow and activity boundaries, state handling, and recovery rules for distributed systems. Claude Code CX Codex Cursor 12,053installs mcp-builder official anthropics This skill walks through building an MCP server in TypeScript or Python, from reading the protocol spec to writing tests and evaluation questions. Claude Code Claude.ai 130,949installs google-agents-cli-adk-code official Google A reference skill for building ADK agents with tools, callbacks, state, and workflows. Use it when an agent project needs concrete API patterns or code examples. Claude Code CX Codex Cursor +1 511,400installs

Questions about php-pro

How to install php-pro in Claude Code?

Run npx skills add Jeffallan/claude-skills --skill php-pro -a claude-code in your terminal. You can also place the skill file directly at ~/.claude/skills/php-pro/SKILL.md.

What does the php-pro skill do?

It enforces strict typing, PSR-12 compliance, readonly DTOs, and dependency injection across Laravel, Symfony, or standalone PHP 8.3+ codebases.

What verification standards does php-pro require?

Implementations must pass vendor/bin/phpstan analyse --level=9 cleanly and achieve at least 80% test coverage using PHPUnit or Pest.

Source text

SKILL.md · MIT
---
name: php-pro
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.
license: MIT
metadata:
  author: https://github.com/Jeffallan
  company: https://synergetic.solutions
  version: "1.1.0"
  domain: language
  triggers: PHP, Laravel, Symfony, Composer, PHPStan, PSR, PHP API, Eloquent, Doctrine
  role: specialist
  scope: implementation
  output-format: code
  related-skills: fullstack-guardian, fastapi-expert
---

# 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
<?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
<?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
<?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', '[email protected]', '<test-password>');
        $user = new User(['name' => 'Alice', 'email' => '[email protected]']);

        $this->users
            ->expects($this->once())
            ->method('create')
            ->willReturn($user);

        $result = $this->service->create($dto);

        $this->assertSame('Alice', $result->name);
    }
}
```

### Enum (PHP 8.1+)

```php
<?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:
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

Maintained by [@jeffallan](https://github.com/jeffallan), Principal Consultant at [Synergetic Solutions](https://synergetic.solutions)

[Documentation](https://jeffallan.github.io/claude-skills/skills/language/php-pro/)

© https://github.com/Jeffallan · MIT · Jeffallan/claude-skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor