php-standards

Applies PSR-4 autoloading, PER Coding Style 3.0, and PSR interfaces to framework-agnostic PHP packages.

1|Updated Jul 29, 2026
One-click install
npx skills add https://github.com/fusengine/kimi-code --skill php-standards-fusengine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: php-standards
Source: https://github.com/fusengine/kimi-code/tree/main/plugins/php-expert/skills/php-standards
Command: npx skills add https://github.com/fusengine/kimi-code --skill php-standards-fusengine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up a framework-agnostic PHP package requires choosing the right autoloading standard, coding style spec, and PSR interfaces, and the PHP-FIG catalog contains deprecated (PSR-0, PSR-2) and abandoned (PSR-8/9/10) standards that are easy to pick by mistake. ## Core Features & Use Cases - PSR-4 Autoloading Setup: Maps namespaces to directories in composer.json, wires tests via autoload-dev, and explains why PSR-0 and target-dir are deprecated. - PER Coding Style 3.0 Guidance: Documents formatting rules (4 spaces, LF endings, no closing ?>), compound type syntax, and the nuance that PER supersedes PSR-12 in practice while PSR-12 remains officially Accepted. - PSR Interface Catalog: Lists which PSR packages to depend on for logging (PSR-3), caching (PSR-6/16), HTTP (PSR-7/15/17/18), DI containers (PSR-11), events (PSR-14), and time (PSR-20). - Use Case: When scaffolding a new PHP library, use this Skill to generate a composer.json with PSR-4 autoload, a src/ and tests/ directory layout, and a php-cs-fixer config using the @PER-CS ruleset. ## Quick Start Set up a new framework-agnostic PHP package with PSR-4 autoloading, PER Coding Style 3.0, and the correct PSR interface dependencies.

Frequently Asked Questions about php-standards

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up PSR-4 autoloading in composer.json?▼

Map your namespace prefix to a base directory under the autoload.psr-4 key, such as "Vendor\\Package\\": "src/". Put test namespaces under autoload-dev so they stay out of consumers' autoloaders, and run composer dump-autoload after structural changes.

What is the difference between PER Coding Style and PSR-12?▼

PER Coding Style 3.0 is the actively maintained spec that extends PSR-12 with rules for newer syntax like enums and compound types. PSR-12 remains the officially Accepted PSR but is frozen; in practice you target the @PER-CS ruleset in php-cs-fixer.

Which PSR should I use for caching in PHP?▼

Use PSR-16 (psr/simple-cache, CacheInterface) for simple key/value caching and PSR-6 (psr/cache, CacheItemPoolInterface) when you need cache pools or deferred saves. Type-hint the interface rather than a concrete cache implementation.

Is PSR-0 autoloading still supported by Composer?▼

PSR-0 is deprecated and should not be used for new code. PSR-4 replaces it by omitting the namespace prefix from the file path and removing the need for target-dir; migrate existing PSR-0 packages to PSR-4 mappings.

Should tests go in autoload or autoload-dev in composer.json?▼

Test classes belong under autoload-dev with their own PSR-4 namespace such as Vendor\Package\Tests\ mapped to tests/. This keeps test classes out of the autoloader shipped to consumers of your library.

When should I not use this PHP standards skill?▼

Do not use it for PHP language syntax or feature questions, which belong to a language-focused skill, or for Laravel-specific conventions, which live in the Laravel plugin. It covers only framework-agnostic package standards.