Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use this skill to set up a basic PHP project. It initializes Composer, installs testing and static analysis tools (PHPUnit, PHPStan, PHP_CodeSniffer), and provisions basic configuration files (phpstan.neon.dist and phpcs.xml).
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | -2% | 0% |
| case-13 | ✗→✓ | ▲ Improved | -44% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 70% | 0% |
| case-05 | ✓→✓ | = Same ✓ | -12% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 22% | 0% |
When the user asks you to initialize or set up a basic PHP project, follow these steps:
First, check if composer.json exists in the project root. If it does not exist, initialize composer with default values by running:
bashcomposer init --no-interaction
Install the required development dependencies. Run the following command:
bashcomposer require --dev phpunit/phpunit phpstan/phpstan squizlabs/php_codesniffer slevomat/coding-standard
Check if phpstan.neon.dist exists. If not, copy the phpstan.neon.dist template from this skill's resources directory to the project root:
bashcp ./resources/phpstan.neon.dist .
> !NOTE] > The source path ./resources/phpstan.neon.dist is relative to the directory of this skill. Ensure you are in the skill directory or provide the correct relative path when executing the copy command.
Make sure to adjust the paths in the copied file if the project uses different directories for its source code and tests.
Check if phpcs.xml exists. If not, copy the phpcs.xml template from this skill's resources directory to the project root to enforce PSR-12 coding standards:
bashcp ./resources/phpcs.xml .
> !NOTE] > The source path ./resources/phpcs.xml is relative to the directory of this skill. Ensure you are in the skill directory or provide the correct relative path when executing the copy command.
You may need to create src and tests directories if they do not exist, as these configuration files expect them.
Once the setup is complete, verify that the files have been created and the dependencies are properly listed in composer.json. Inform the user that the PHP project has been successfully initialized and configured with PHPUnit, PHPStan, and PHP_CodeSniffer.
Other measured skills in the registry, with their headline benchmark lift.