phpcq/author-validation
CLI tool to validate author metadata across a repo: checks PHP file headers and composer.json/bower.json/packages.json against git history. Supports YAML config for author alias mapping, ignore/include/exclude rules, and copy-left enforcement.
phpunit, pint) by addressing a non-functional but critical requirement.schedule)..blade.php files by default. Requires custom config (e.g., include: ["resources/views/**/*.blade.php"]) or post-processing (e.g., sed to convert Blade to PHP for validation).vendor/ by default (recommended) but may need inclusion for custom packages."John Doe" vs. "john doe" may fail. Mitigate with config normalization (e.g., .check-author.yml mapping).git fetch may cause missing author data. Enforce git fetch --unshallow in CI.git log --format='%aN <%aE>' | sort | uniq).include/exclude rules are misconfigured. Document defaults in README.md../vendor/bin/check-author.php app/)..blade.php) be validated? If yes, how to handle dynamic content (e.g., @include)?vendor/) be excluded or validated?package.json authors)?config/app.php copyright headers)?git init) or validate all history?.check-author.yml be auto-generated from Git logs?.gitignore vs. committed)?require-dev.on: [push]).before_script).package.json authors if using frontend assets.Phase 1: CI-Only Validation (Low Risk)
composer.json:
"require-dev": {
"phpcq/author-validation": "^1.0"
}
- name: Validate Authors
run: ./vendor/bin/check-author.php --path=app/
Phase 2: Pre-Commit Hook (Medium Risk)
package.json:
"scripts": {
"prepare": "husky install",
"check-authors": "./vendor/bin/check-author.php --path=app/"
}
pre-commit:
echo 'node scripts/check-authors.js' >> .husky/pre-commit
Phase 3: Laravel Artisan Command (High Customization)
./vendor/bin/check-author.php --publish-config
php artisan make:command ValidateAuthors
// app/Console/Commands/ValidateAuthors.php
public function handle() {
$command = base_path('vendor/bin/check-author.php');
$exitCode = shell_exec("{$command} --path=app/ --exclude=vendor/");
if ($exitCode !== 0) {
$this->error('Author validation failed!');
exit(1);
}
}
app/**/*.php) and relative/absolute paths.--path or .check-author.yml..check-author.yml: Must exist or be auto-generated. Example:
include:
- app/
- config/
exclude:
- vendor/
- tests/
mapping:
"Old Name <old@example.com>": "New Name <new@example.com>"
metadata key to add roles/homepages (e.g., for diff output).--recursive or manual path inclusion.--path=laravel-app/).include or pre-process files (e.g., php artisan view:clear + custom script).composer install but before tests/deploy:
jobs:
validate-authors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: composer install
- run: ./vendor/bin/check-author.php --path=app/
- run: php artisan test
- run: git fetch --unshallow
How can I help you explore Laravel packages today?