From dave-liddament
Set up a new PHP project with standard tooling and configuration. Use when creating a new PHP project or ensuring an existing project has the correct setup.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dave-liddament:php-project-setupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Set up or complete the setup of a PHP project with the standard tooling and configuration described below.
Set up or complete the setup of a PHP project with the standard tooling and configuration described below.
IMPORTANT: This skill works on both new and existing projects. Before each step, check what already exists and only add what is missing. Do not duplicate or overwrite existing configuration unless it conflicts with the requirements below.
Ensure the following directories exist:
src/tests/utils/Detect the installed PHP version by running php -v and extracting the major.minor version (e.g. 8.5). Set the require.php constraint in composer.json to ~X.Y (e.g. ~8.5).
Install with composer require (skip any already present):
dave-liddament/php-language-extensionsInstall with composer require --dev (skip any already present):
bamarni/composer-bin-pluginphpstan/phpstanphpstan/phpstan-strict-rulesphpstan/phpstan-phpunitphpstan/phpstan-webmozart-assertdave-liddament/phpstan-php-language-extensionsspaze/phpstan-disallowed-callsrector/rectorphpunit/phpunitEnsure composer.json contains the following extra configuration:
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": true
}
}
Install each in its own namespace to avoid dependency clashes. Skip any already present:
composer bin cs-fixer require --dev friendsofphp/php-cs-fixercomposer bin parallel-lint require --dev php-parallel-lint/php-parallel-lintcomposer bin require-checker require --dev maglnet/composer-require-checkercomposer bin unused require --dev icanhazstring/composer-unusedEnsure the following scripts are defined in composer.json. Merge with any existing scripts:
"scripts": {
"setup": [
"@composer install",
"@composer bin all install"
],
"ci": [
"@composer-validate",
"@lint",
"@composer-unused",
"@composer-require-checker",
"@cs",
"@phpstan",
"@test"
],
"ci-local": [
"@composer-validate",
"@lint",
"@composer-unused",
"@composer-require-checker",
"@cs-fix",
"@phpstan",
"@test"
],
"composer-validate": "@composer validate --no-check-all --strict",
"lint": "parallel-lint src tests utils",
"composer-unused": "composer-unused",
"composer-require-checker": "composer-require-checker check",
"cs": "php-cs-fixer fix -v --dry-run",
"cs-fix": "php-cs-fixer fix -v",
"phpstan": "phpstan analyse --no-progress",
"test": "phpunit"
}
phpstan.neon)If no phpstan.neon exists, copy the template from ${CLAUDE_SKILL_DIR}/phpstan.neon into the project root.
If a phpstan.neon already exists, merge the template into the existing configuration. Ensure all includes, rules, and paths from the template are present without removing any existing configuration.
.php-cs-fixer.php)If no .php-cs-fixer.php exists, copy the template from ${CLAUDE_SKILL_DIR}/.php-cs-fixer.php into the project root.
If .php-cs-fixer.php already exists, leave it as-is.
phpunit.xml)If no phpunit.xml or phpunit.xml.dist exists, generate the configuration by running:
./vendor/bin/phpunit --generate-configuration
Ensure .gitignore contains at least the following entries (merge with any existing .gitignore):
/vendor/
/vendor-bin/*/vendor/
/.php-cs-fixer.cache
/.phpunit.cache/
/.idea/
After setup, run composer run ci-local to verify everything is working correctly.
npx claudepluginhub daveliddament/php-claude-skills --plugin dave-liddamentGenerates PHPStan configs (phpstan.neon, baselines) for PHP 8.4+ projects with levels, paths, strict rules, and DDD/Doctrine support. For new, legacy, or domain-driven apps.
Foundational PHP project knowledge for AI agents. Use when working on a PHP project, setting up a PHP development environment, understanding PHP project structure, following PHP coding standards, running PHP tests, using Composer, or when guidance on PHP-specific tools and workflows in PhpStorm is needed.
Modernizes PHP codebases to PHP 8.1–8.5 with Rector, PHPStan, PHP-CS-Fixer, PHPat, DTOs, enums, readonly, property hooks, and PSR/PER-CS compliance. Includes guarded workflows for Doctrine, Symfony, API Platform, and mutation testing.