agentsclimarketplace

Php standards

Skill fusengine/agents/plugins/php-expert/skills/php-standards

Use when setting up a PHP package, choosing a coding style, wiring autoloading, or selecting PSR interfaces — PSR-4 autoloading, PER Coding Style 3.0 vs PSR-12, the active PSR catalog, and modern composer.json. Do NOT use for language syntax/features (use php-language-modern) or Laravel-specific conventions (use the laravel plugin).From its SKILL.md

Install
npx -y skills add fusengine/agents --skill php-standards

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 22 stars22 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.2 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it

PHP Standards (PSR / PER / Composer)

Agent Workflow (MANDATORY)

Before applying a standard, use TeamCreate to spawn 3 agents:

  1. fuse-ai-pilot:explore-codebase - Detect existing style config (.php-cs-fixer.php, phpcs.xml), composer.json autoload
  2. fuse-ai-pilot:research-expert - Verify a PSR's current status on php-fig.org before recommending it
  3. mcp__context7__query-docs - Cross-check composer.json schema

After changes, run fuse-ai-pilot:sniper for validation.


Overview

ConcernStandardNotes
AutoloadingPSR-4Recommended; PSR-0 is deprecated
Coding stylePER Coding Style 3.0"Extends, expands and replaces PSR-12"; PSR-12 remains the Accepted PSR
LoggingPSR-3LoggerInterface
CachingPSR-6 / PSR-16Pool vs Simple Cache
HTTPPSR-7 / 15 / 17 / 18Message / Handlers / Factories / Client
DI containerPSR-11ContainerInterface
EventsPSR-14Event Dispatcher
TimePSR-20ClockInterface — testable "now"

Critical Rules

  1. PSR-4 for autoloading, never PSR-0 - PSR-0 and target-dir are deprecated. See psr4-autoloading.md.
  2. PER Coding Style 3.0 is the current style spec - It supersedes PSR-12 in practice while requiring PSR-1. PSR-12 is still the officially Accepted PSR — document the nuance, don't pretend PSR-12 was withdrawn. See per-coding-style.md.
  3. Depend on PSR interfaces, not implementations - Type-hint Psr\Log\LoggerInterface, not a concrete logger.
  4. 4 spaces, no tabs; LF line endings; omit closing ?> - Core PER/PSR-1 file rules.
  5. src/ for library code, tests/ for tests - Wire tests/ via autoload-dev, never autoload.

Architecture

my-package/
├── composer.json           # PSR-4 autoload + autoload-dev + scripts
├── src/                    # Namespace root (Vendor\Package\)
│   └── Service.php
├── tests/                  # PSR-4 dev namespace (Vendor\Package\Tests\)
│   └── ServiceTest.php
└── bin/                    # CLI entry points (composer "bin")

→ See project-structure.md for the full layout


Reference Guide

Concepts

TopicReferenceWhen to Consult
PER Coding Styleper-coding-style.mdFormatting rules, PER vs PSR-12
PSR catalogpsr-catalog.mdWhich PSR to depend on / avoid
PSR-4 autoloadingpsr4-autoloading.mdNamespace-to-path mapping

Templates

TemplateWhen to Use
composer-json.mdStarting or modernizing a package
project-structure.mdLaying out directories

Best Practices

DO

  • Use PSR-4 with src/ mapped to the vendor namespace
  • Follow PER Coding Style 3.0 (run php-cs-fixer with the @PER-CS ruleset)
  • Depend on PSR interface packages (psr/log, psr/http-message, …)
  • Put test-only classes under autoload-dev

DON'T

  • Use PSR-0 autoloading or target-dir (deprecated)
  • Claim PER "replaced" PSR-12 as the official standard — PSR-12 is still Accepted
  • Depend on PSR-2/PSR-0 (deprecated) or PSR-8/9/10 (abandoned)
  • Hardcode a concrete logger/cache when a PSR interface exists

What ships with it: 6 files

13.7 KB alongside SKILL.md

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.