skillfed

php-rules

PHP Rules enforces coding standards covering style, frameworks, patterns, security, and testing. It guides PSR-12 compliance, modern PHP 8.1+ syntax, Laravel and Symfony conventions, Eloquent and Doctrine patterns, and error handling best practices.

PHP Rules applies comprehensive coding standards, style guidelines, and framework best practices for PHP development.

AI-generated summary based on this skill's SKILL.md

161 21 Apache-2.0 updated by softspark

Install

softspark/ai-toolkit/php-rules · repository language: Python

git clone https://github.com/softspark/ai-toolkit
cp -r ai-toolkit/app/skills/php-rules ~/.claude/skills/php-rules
npx skillfed install softspark/ai-toolkit/php-rules

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What PHP coding standards and best practices does php-rules cover?

PHP Rules enforces coding standards covering style, frameworks, patterns, security, and testing. It guides PSR-12 compliance, modern PHP 8.1+ syntax, Laravel and Symfony conventions, Eloquent and Doctrine patterns, and error handling best practices.

How does php-rules help prevent SQL injection and XSS attacks?

PHP Rules implements secure PHP code practices preventing SQL injection and XSS vulnerabilities. It covers parameterized queries, input validation, output escaping, CSRF protection in Blade templates, and secure file upload handling to protect against common web vulnerabilities.

Does php-rules support Laravel and Symfony framework code?

PHP Rules includes comprehensive guidance for writing and reviewing Laravel and Symfony framework code. It covers Laravel Eloquent ORM patterns, API Resources, authentication with Sanctum and Passport, queue workers with Horizon, Form Requests validation, and Symfony dependency injection autowiring and Forms validation.

What testing frameworks and practices does php-rules recommend?

PHP Rules guides creation of comprehensive PHP unit and integration tests using PHPUnit and Pest testing frameworks. It emphasizes test structure, assertions, mocking, and integration testing patterns to ensure robust code quality and reliability.

How does php-rules address modern PHP features and refactoring?

PHP Rules supports refactoring PHP code using modern language features and patterns including PHP 8.1+ union types, enums, static analysis with PHPStan, repository patterns, and eager loading optimization to prevent N+1 query problems in Eloquent.

SKILL.md

rendered from the published skill — quoted content, verbatim

PHP Rules

These rules come from app/rules/php/ in ai-toolkit. They cover the project's standards for coding style, frameworks, patterns, security, and testing in PHP. Apply them when writing or reviewing PHP code.

PHP Coding Style

Standards

  • Follow PSR-12 extended coding style.
  • Use declare(strict_types=1) at the top of every file.
  • Use PHP 8.1+ features: enums, fibers, readonly properties, intersection types.
  • Use PHP CS Fixer or Pint for automated formatting.

Naming

  • PascalCase: classes, interfaces, traits, enums.
  • camelCase: methods, functions, variables.
  • UPPER_SNAKE: class constants (public const MAX_RETRIES = 3).
  • snake_case: not used for methods. PSR convention is camelCase.
  • Suffix interfaces with Interface or prefix with contract name (project convention).

Type System

  • Use typed properties: private readonly string $name;.
  • Use union types: string|int. Use intersection types: Countable&Iterator.
  • Use enum

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
app/skills/php-rules/SKILL.md

Related skills

Tags

code-quality framework-agnostic orm-patterns api-development queue-systems auth-security testing-practices static-analysis database-design web-vulnerabilities