captainhook/captainhook-phar
Composer installer for the CaptainHook PHAR. Adds CaptainHook to vendor/bin for use in projects and updates it automatically on composer update. See captainhook/captainhook for source, quick start, and full docs at captainhook.info.
php artisan test, php artisan migrate:status).config/ structure (e.g., config/hook.php).husky, pre-commit).composer require --dev, keeping it out of production builds.composer update, but version pinning is recommended for stability..git/hooks/ by default, which may conflict with manual hooks. Mitigation:
hooks/) and symlink to .git/hooks/.hook:install, hook:test) to manage hooks programmatically.HookServiceProvider to dynamically load hook configs from Laravel’s config system.- name: Run pre-commit hooks
run: php vendor/bin/hook run pre-commit
dist config:
"config": {
"preferred-install": "dist",
"checksum": {
"captainhook/captainhook-phar": "sha256:..."
}
}
.git/hooks/ may break manual hooks. Mitigation:
hooks/ directory and symlink:
mkdir -p hooks
ln -s hooks/pre-commit .git/hooks/pre-commit
CONTRIBUTING.md.roave/infection, dealerdirect/phpcodesniffer-composer-installer) if critical.migrate or queue:work hooks). Mitigation:
# hooks.yml
hooks:
pre-push:
- "php artisan migrate:status --env=production"
- "php artisan queue:work --once --env=production"
phpcs via Composer scripts)?husky + laravel-mix if the team uses both stacks.spatie/laravel-permission for role-based hook access.git commit) or run in parallel?hook:list).config/hook.php.Pilot Phase (2 Weeks):
composer require --dev captainhook/captainhook-phar
vendor/bin/hook init
hooks.yml:
hooks:
pre-commit:
- "php artisan test --env=testing"
- "php vendor/bin/pint"
pre-push:
- "php artisan migrate:status"
.git/hooks/.Gradual Rollout (4 Weeks):
php artisan optimize).hooks.yml template for new repos.--no-verify for emergencies).Full Adoption (Ongoing):
- name: Verify hooks
run: |
if ! php vendor/bin/hook run pre-commit; then
echo "::error::Pre-commit hooks failed"
exit 1
fi
vendor/bin/hook debug).# hooks.yml
hooks:
pre-commit:
- "php artisan test --env=testing"
pre-push:
- "php artisan migrate:fresh --env=staging" # Only for staging
config() helper:
// app/Providers/AppServiceProvider.php
public function boot()
{
$hooks = config('hook.config');
// Integrate
How can I help you explore Laravel packages today?