Agent-skills-standard php-tooling
Configure PHP ecosystem tooling, dependency management, and static analysis. Use when managing Composer dependencies, running PHPStan, or configuring PHP build tools. (triggers: composer.json, composer, lock, phpstan, xdebug)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/php/php-tooling" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-php-tooling && rm -rf "$T"
manifest:
skills/php/php-tooling/SKILL.mdsource content
PHP Tooling
Priority: P2 (MEDIUM)
Structure
project/ ├── composer.json ├── phpstan.neon └── .php-cs-fixer.php
Implementation Guidelines
- Composer: Always commit
for applications. Usecomposer.lock
andcomposer audit
(notcomposer install in CI
) for locked versions.update - Autoloading: Strictly enforce PSR-4 autoloading in
(e.g.,composer.json
— ensure backslashes escaped). Run"psr-4": {"App\\": "src/"}
after changes.composer dump-autoload - Static Analysis: Mandate PHPStan (Level 5+) or Psalm in CI. Install via
. Createcomposer require --dev phpstan/phpstan
withphpstan.neon
. Run viaparameters: { paths: [src], level: 6 }
.vendor/bin/phpstan analyse - Linting: Automate PSR-12 standards via
. Configure incomposer require --dev friendsofphp/php-cs-fixer
with.php-cs-fixer.php
. Use$config->setRules(['@PSR12' => true])
to enforce standards.php-cs-fixer - Execution: Use
to leverage performance improvements (JIT, OpCache).PHP 8.1+ - Scripts: Define standard task
in"scripts": {
(composer.json
). Run with"analyze": "phpstan analyse", "test": "phpunit", "check": ["@fix", "@analyze", "@test"]}
.composer check - Debugging: Use
for local development only. Remove xdebug.so from prod config or set XDEBUG_MODE=off in production.Xdebug - Docker: Use Multi-stage Dockerfiles with
orphp:8.x-fpm
base images.php:8.x-cli
Anti-Patterns
- No manual
: Use Composer PSR-4 autoloading only.require - No blind composer updates: Review
diff first.composer.lock - No Xdebug in production: Disable extension in prod env.
- No
in git: Exclude viavendor/
; use Composer..gitignore