home / skills / hoangnguyen0403 / agent-skills-standard / tooling
This skill helps PHP projects maintain quality with Composer lock parity, PSR-4 autoload, PHPStan analysis, and PHP CS Fixer linting.
npx playbooks add skill hoangnguyen0403/agent-skills-standard --skill toolingReview the files below or copy the command above to add this skill to your agents.
---
name: PHP Tooling
description: PHP ecosystem tooling, dependency management, and static analysis.
metadata:
labels: [php, composer, toolchain, static-analysis]
triggers:
files: ['composer.json']
keywords: [composer, lock, phpstan, xdebug]
---
# PHP Tooling
## **Priority: P2 (MEDIUM)**
## Structure
```text
project/
├── composer.json
├── phpstan.neon
└── .php-cs-fixer.php
```
## Implementation Guidelines
- **Composer Lock**: Commit `composer.lock` for environment parity.
- **PSR-4**: Strictly map namespaces to `src/` and `tests/`.
- **Static Analysis**: Integrate **PHPStan** (level 5+) in CI.
- **Linting**: Automate PSR-12 enforcement via **PHP CS Fixer**.
- **Debugging**: Use **Xdebug** for profiling; avoid `var_dump`.
- **Scripts**: Define `lint`, `analyze`, `test` in `composer.json`.
## Anti-Patterns
- **Manual Requires**: **No Manual Require**: Rely on Composer autoload.
- **Blind Updates**: **No Blind Updating**: Review `composer.lock` diffs.
- **Production Debug**: **No Prod Xdebug**: Disable debugging in live env.
- **Vendor Commits**: **No Vendor Check-in**: Exclude `vendor/` from git.
## Code
```json
{
"autoload": {
"psr-4": { "App\\": "src/" }
},
"scripts": {
"analyze": "phpstan analyze"
}
}
```
This skill provides concrete tooling and configuration guidance for PHP projects to ensure consistent dependency management, coding standards, and static analysis. It outlines a minimal project structure and recommends CI-integrated checks for maintainability and safety. The focus is on practical rules you can apply immediately to PHP applications and libraries.
The skill inspects project layout and key configuration files like composer.json, phpstan.neon, and .php-cs-fixer.php to verify best-practice setup. It enforces committing composer.lock, PSR-4 autoloading, Composer scripts for lint/analyze/test, and CI integration for PHPStan and PHP CS Fixer. It also flags common anti-patterns such as committing vendor/, manual require statements, and leaving Xdebug enabled in production.
Should I always commit composer.lock for libraries?
Yes for applications to lock transitive versions; for libraries commit if you need reproducible builds in your delivery process, but consider semantic versioning for published packages.
What PHPStan level should I target first?
Start at level 5 as a practical balance; if the codebase is healthy you can raise the level incrementally to tighten checks.