$npx skillfedfor your agent

php-best-practices

PHP Best Practices audits your code against 51 rules covering type systems, modern PHP 8.x features, PSR standards, SOLID principles, error handling, performance, and security. It detects your project's PHP version and applies only relevant guidance, from union types and match expressions in 8.0 through property hooks and the pipe operator in 8.4+.

PHP Best Practices reviews your code against modern PHP 8.x standards and SOLID principles.

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

58 9 MITupdated by AsyrafHussin

Decision gist · record as of 2026-05-16

PHP Best Practices reviews your code against modern PHP 8.x standards and SOLID principles. PHP Best Practices audits your code against 51 rules covering type systems, modern PHP 8.x features, PSR standards, SOLID principles, error handling, performance, and security. It detects your project's PHP version and applies only relevant guidance, from union types and match expressions in 8.0 through property hooks and the pipe operator in 8.4+.

manual: git clone https://github.com/AsyrafHussin/agent-skills → cp -r agent-skills/skills/php-best-practices ~/.claude/skills/php-best-practices
skills/php-best-practices/SKILL.md · version a028da83

Use it when

  • Yes.
  • PHP Best Practices audits code for SOLID principles and design pattern compliance, helping you identify violations of Single Responsibility.

Verify before relying

Read SKILL.md below before installing (57 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

AsyrafHussin/agent-skills/php-best-practices

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

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

How does PHP Best Practices review my PHP code for best practices?

PHP Best Practices audits your code against 51 rules covering type systems, modern PHP 8.x features, PSR standards, SOLID principles, error handling, performance, and security. It detects your project's PHP version and applies only relevant guidance, from union types and match expressions in 8.0 through property hooks and the pipe operator in 8.4+.

Can PHP Best Practices check PHP 8 type safety in my code?

Yes. PHP Best Practices ensures type safety and strict typing in PHP 8.x code by validating union types, nullable types, strict types declarations, and constructor promotion syntax. It verifies that your type hints align with PHP 8.x standards and flags unsafe type coercion patterns.

What SOLID principles does PHP Best Practices audit for?

PHP Best Practices audits code for SOLID principles and design pattern compliance, helping you identify violations of Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion principles. It reviews class structure, inheritance hierarchies, and dependency injection patterns.

Does PHP Best Practices validate PSR standards and coding style?

Yes. PHP Best Practices validates PSR standards and coding style conformance, checking your code against established PHP Standards Recommendations. It reviews naming conventions, formatting, and structural guidelines to ensure consistency with industry-standard practices.

What PHP 8.x modern features can PHP Best Practices help me learn?

PHP Best Practices guides you through PHP 8.x modern features and version-specific syntax including match expressions, enums, readonly properties, constructor promotion, union and intersection types, attributes, and named arguments. It provides examples and best-practice guidance for each feature.

Does PHP Best Practices detect security issues in my code?

PHP Best Practices reviews code quality across multiple dimensions including error handling best practices, performance optimization, and security considerations. While primarily focused on code standards and modern PHP practices, it helps identify patterns that may impact security and reliability.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

PHP Best Practices

Modern PHP 8.x patterns, PSR standards, type system best practices, and SOLID principles. Contains 51 rules for writing clean, maintainable PHP code.

Step 1: Detect PHP Version

Always check the project's PHP version before giving any advice. Features vary significantly across 8.0 - 8.5. Never suggest syntax that doesn't exist in the project's version.

Check composer.json for the required PHP version:

{ "require": { "php": "^8.1" } }   // -> 8.1 rules and below
{ "require": { "php": "^8.3" } }   // -> 8.3 rules and below
{ "require": { "php": ">=8.4" } }  // -> 8.4 rules and below

Also check the runtime version:

php -v   # e.g. PHP 8.3.12
Feature Availability by Version

| Feature | Version | Rule Prefix

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

File tree — 15 files
skills/php-best-practices/AGENTS.md
skills/php-best-practices/README.md
skills/php-best-practices/SKILL.md
skills/php-best-practices/metadata.json
skills/php-best-practices/rules/_sections.md
skills/php-best-practices/rules/_template.md
skills/php-best-practices/rules/error-custom-exceptions.md
skills/php-best-practices/rules/error-exception-hierarchy.md
skills/php-best-practices/rules/error-finally-cleanup.md
skills/php-best-practices/rules/error-never-suppress.md
skills/php-best-practices/rules/error-try-catch-specific.md
skills/php-best-practices/rules/modern-arrow-functions.md
skills/php-best-practices/rules/modern-asymmetric-visibility.md
skills/php-best-practices/rules/modern-attributes.md
skills/php-best-practices/rules/modern-constructor-promotion.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Review PHP code against modern standards and best practices”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

Php Modernization
by netresearch · netresearch/php-modernization-skill

Upgrade legacy PHP projects to current language standards using PHP 8.1+ features, strict typing, and modern patterns. This skill guides you through static analysis configuration, automated refactoring with Rector, code style fixes, and architectural improvements like DTOs and enums. It enforces best practices across PSR compliance, PHPStan levels, and framework-specific patterns while protecting critical code from unsafe transformations.

no license declared → metadata onlyupdated Jul 2026
★ 36repo stars
php
by xobotyi · xobotyi/cc-foundry

PHP guides you through modern language conventions, strict type declarations, and contemporary idioms for PHP 8.5+. It covers naming standards, type system rules, enumerations, class design patterns, and functional programming constructs to keep your code explicit and maintainable.

MITupdated Jul 2026
★ 18repo stars
php-specialist
by Pixel-Process-UG · Pixel-Process-UG/superkit-agents

PHP Specialist guides you through modern PHP 8.x development with language features like enums, readonly properties, and match expressions. It covers the complete toolchain: PSR interoperability, Composer dependency management, static analysis configuration, and coding standards enforcement. Apply it whenever you're authoring, reviewing, or refactoring PHP code to ensure type safety and architectural correctness.

MITupdated Mar 2026
★ 1repo stars
Php Modernization
by dirnbauer · dirnbauer/webconsulting-skills

Upgrade legacy PHP projects to current language versions and coding standards. This skill guides you through type declarations, PSR/PER-CS compliance, static analysis setup, and modern patterns like DTOs and enums. It covers PHP 8.1 through 8.5 features, Rector automation, PHPStan configuration, and framework-specific edges.

no license declared → metadata onlyupdated Jul 2026
★ 33repo stars
php-development
by Mindrally · Mindrally/skills

PHP Development provides expert guidance for building robust applications using PHP 8.1+ with strict typing, SOLID principles, and PSR standards. Learn proper code organization through dependency injection, repository patterns, and comprehensive error handling. The skill emphasizes type declarations, security practices, and testing strategies to ensure maintainable, scalable code.

Apache-2.0updated Jun 2026
★ 202repo stars
php-expert
by personamanagmentlayer · personamanagmentlayer/pcl

PHP Expert provides in-depth instruction on PHP 8+ language features including union types, named arguments, match expressions, attributes, and enums. Learn Laravel framework patterns, Composer dependency management, and object-oriented design principles for building robust applications.

Apache-2.0updated Mar 2026
★ 38repo stars

More skills php-pro (MIT) · magento-php-specialist (MIT) · php (MIT)

Tags
code-qualitytype-safetymodern-syntaxdesign-patternsstatic-analysisphp-standardsimmutabilityfunctional-programmingversion-awaresecurity-audit