No slash command · from php-foundation
Provides Composer conventions for PHP projects: dependency management, version constraints, PSR-4 autoloading, scripts, and composer.json vs composer.lock contract. Stack-agnostic.
Ships in php-foundation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Composer is the dependency manager and autoloader entry point for every modern PHP project. Read composer.json before doing anything else — it tells you the PHP version, the framework, and the available packages.
cat composer.json # PHP version (require.php), framework, scripts
test -f composer.lock && echo "locked" # lockfile present → reproducible installs
Key fields to read:
require.php — minimum PHP version (drives which language features you may use).require — runtime dependencies; the framework marker lives here (laravel/framework, symfony/framework-bundle).require-dev — dev/test tooling (phpunit, pest, phpstan, pint, php-cs-fixer).autoload.psr-4 — namespace → directory map.config.platform.php — pins the version the resolver targets (may differ from the runtime PHP).composer.json declares intent — version ranges you accept.composer.lock records the exact resolved versions. It is committed and is the source of truth for composer install.| Command | Effect |
|---|---|
composer install | Installs the exact versions from composer.lock. Use in CI/deploy. |
composer update <pkg> | Re-resolves the named package, rewrites the lock. Use deliberately. |
composer require <pkg> | Adds to composer.json + updates the lock for that package. |
composer require --dev <pkg> | Same, into require-dev. |
Never hand-edit composer.lock. Never run a bare composer update (updates everything) as part of a focused feature change.
{
"require": {
"php": "^8.2", // >=8.2.0 <9.0.0 — recommended for libraries/apps
"guzzlehttp/guzzle": "^7.8" // caret: compatible up to the next major
}
}
^7.8 — allows >=7.8.0 <8.0.0. The default; respects SemVer.~7.8.0 — allows >=7.8.0 <7.9.0. Tighter; use when you must pin to a minor.7.8.3 — avoid except to work around a specific broken release.* and unbounded >= — they break reproducibility.composer why-not <pkg> / check existing require).require (runtime) vs require-dev (tools/tests) correctly.composer require <pkg> so the lockfile updates atomically.composer.lock diff — only the new package and its deps should change.{
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
}
}
composer dump-autoload.autoload-dev so they are excluded from production autoload maps.composer dump-autoload --optimize (or --classmap-authoritative).{
"scripts": {
"test": "phpunit",
"stan": "phpstan analyse",
"cs": "php-cs-fixer fix"
}
}
Run via composer test, composer stan. Prefer existing scripts over invoking the binary directly — they encode the project's intended flags. Discover them with composer run-script --list.
{
"config": {
"platform": {
"php": "8.2.0"
}
}
}
config.platform.php tells Composer which PHP version to resolve against, independent of the local CLI version — keep it aligned with the production runtime so the lockfile is deployable.
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/php-conventionsModern PHP idioms for any PHP project (PHP 8.1+): readonly properties, enums, match expressions, constructor property promotion, typed properties, named arguments, nullsafe operator, first-class callable syntax, strict_types, PSR-12 style, and null discipline. Apply when the project is a PHP 8.1+ project. Stack-agnostic — referenced by every PHP plugin in the marketplace.
Use this skill to:
- Write strongly-typed, immutable-by-default value objects with readonly properties and enums.
- Replace switch ladders and magic constants with match expressions and backed enums.
- Cut constructor boilerplate with property promotion and express optionality with typed nullable returns.
- Keep code PSR-12 compliant with declare(strict_types=1) in every file.
Do NOT use this skill for:
- Framework-specific idioms (Eloquent, Doctrine, Symfony services, Laravel facades — those live in framework plugin skills).
- Composer / autoloading / dependency management — see php-foundation:composer-tooling.
- Testing patterns — see php-foundation:php-testing.
/php-testingPHPUnit and Pest patterns for any PHP project: test structure, naming, data providers, test doubles (mocks/stubs/fakes), fixtures, and coverage targets. Stack-agnostic — referenced by every PHP plugin in the marketplace.
Use this skill to:
- Structure unit and integration tests with PHPUnit or Pest consistently.
- Drive cases with data providers / datasets instead of copy-pasted test bodies.
- Use test doubles with discipline — mock collaborators, not the system under test.
- Set up and tear down fixtures cleanly and aim for a meaningful coverage target.
Do NOT use this skill for:
- PHP language idioms — see php-foundation:php-conventions.
- Composer / autoloading — see php-foundation:composer-tooling.
- Framework-specific test helpers (Laravel RefreshDatabase/actingAs, Symfony WebTestCase/KernelTestCase) — those are injected by the framework plugin's QA phase.
npx claudepluginhub aratkruglik/claude-sdlc --plugin php-foundationOther plugins' skills for the same job