GitHub Action to check and fix PHP code style with PHP-CS-Fixer.
- ✅ Validates config file exists
- ✅ Configurable PHP version and paths
- ✅ Dry-run mode (check only, no fixes)
- ✅ Automatic cache - Caches
.php-cs-fixer.cachefor 60% faster runs
- uses: zeroseven/action-php-cs-fixer@v1
with:
config: '.php-cs-fixer.php'
paths: 'src/'| Input | Description | Required | Default |
|---|---|---|---|
php-version |
PHP version | No | 8.3 |
config |
Path to .php-cs-fixer.php | Yes | - |
paths |
Paths to check | No | . |
dry-run |
Dry-run mode (no fixes) | No | true |
This action automatically caches PHP-CS-Fixer's cache file (.php-cs-fixer.cache) to speed up subsequent runs.
Cache Key Strategy:
- Primary:
php-cs-fixer-{OS}-{PHP version}-{PHP files hash}-{config hash} - Fallback:
php-cs-fixer-{OS}-{PHP version}-
Expected Performance:
- First run: 30-60 seconds
- Cached run: 10-20 seconds (~60% faster)
Cache Invalidation:
- Cache refreshes when PHP files or config changes
- Manual clear: Repository Settings → Actions → Caches
MIT