Download the PHP package fernleafsystems/qa without Composer
On this page you can find all versions of the php package fernleafsystems/qa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fernleafsystems/qa
More information about fernleafsystems/qa
Files in fernleafsystems/qa
Package qa
Short Description Shared PHP code quality configuration for FernleafSystems projects
License MIT
Informations about the package qa
FernleafSystems QA
Shared PHP code quality configuration for all FernleafSystems projects. One package gives you consistent code style, static analysis, and pre-commit hooks across all your repositories.
Installation
Quick Start
Step 1: Run the setup wizard to generate configuration files:
Step 2: Install the git hooks:
Both steps are required. The wizard generates config files including captainhook.json. The composer install reads that file and installs the actual git hooks.
The wizard will ask you:
- PHP version (detected from your
composer.json) - Source directory (defaults to
src,lib,appif found) - Whether to include your
testsdirectory - PHPStan strictness level (3 = conservative, 6 = strict)
What Gets Generated
| File | Purpose |
|---|---|
.php-cs-fixer.php |
Code style rules (non-WordPress projects) |
.phpcs.xml.dist |
WordPress Coding Standards (WordPress projects) |
rector.php |
Automated refactoring rules |
phpstan.neon |
Static analysis configuration |
captainhook.json |
Pre-commit hook configuration |
.gitattributes |
Line endings, diff settings, export-ignore rules |
Running the Tools
After setup, run the tools directly via vendor/bin/:
Optional: Add Composer Scripts
For convenience, add these to your project's composer.json:
Then run: composer cs, composer rector, etc.
Pre-Commit Hooks
Important: Git hooks require TWO steps to install:
- Run
vendor/bin/qa-setup- this generatescaptainhook.json - Run
composer install- this triggers CaptainHook to install the git hooks
Without both steps, hooks will NOT be installed.
Once installed, on every commit:
- Rector runs on staged PHP files (with parallel mode disabled)
- PHP CS Fixer runs on staged PHP files
- If files were modified, the commit is blocked with a message to re-stage
This ensures all committed code meets quality standards.
Manual Usage (Without Setup Wizard)
If you prefer to create configs manually, here's a minimal .php-cs-fixer.php:
Available rulesets: Php83, Php84, Php85
Customizing Rules
Adding Custom CS Fixer Rules
Excluding Paths
Edit the generated config files directly. For example, in rector.php:
Adjusting PHPStan Level
Edit phpstan.neon:
CI Integration
Example GitHub Actions workflow:
Supported PHP Versions
Requires PHP 8.3+
- PHP 8.3, 8.4
- PHP 8.5 (forward-compatible, uses 8.4 rules until 8.5-specific rules exist)
Coding Standards
This package enforces FernleafSystems coding standards:
- Tabs for indentation
- No spaces in string concatenation:
'foo'.$bar - Spaces inside parentheses:
function( $param ) - Opening braces on same line
- PSR-12 as base with customizations
- Strict types declaration on same line as opening tag
Troubleshooting
Git hooks not running
You must complete BOTH steps:
vendor/bin/qa-setup- generatescaptainhook.jsoncomposer install- installs the git hooks
Check that captainhook.json exists in your project root. If not, run vendor/bin/qa-setup.
Pre-commit hook blocks my commit
The hook detected that Rector or CS Fixer modified your files. Run:
Tools not found after install
Run composer install again to trigger the CaptainHook installer.
Skip pre-commit hooks (emergency only)
All versions of qa with dependencies
friendsofphp/php-cs-fixer Version ^3.92
rector/rector Version ^2.3
phpstan/phpstan Version ^2.1
captainhook/captainhook Version ^5.25
captainhook/hook-installer Version ^1.0
phpcsstandards/php_codesniffer Version ^4.0
wp-coding-standards/wpcs Version ^3.3
phpcompatibility/phpcompatibility-wp Version ^2.1
dealerdirect/phpcodesniffer-composer-installer Version ^1.0