Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Composer Git Hooks

Composer Git Hooks Laravel Package

brainmaestro/composer-git-hooks

Manage Git hooks via Composer scripts. Install, version, and run pre-commit/pre-push and more across your team using composer install/update. Simple config, no extra tooling, keeps hooks consistent in any PHP project.

View on GitHub
Deep Wiki
Context7

Easily manage git hooks in your composer config

Frequently asked questions about Composer Git Hooks
How do I install this package for a Laravel project?
Run `composer require brainmaestro/composer-git-hooks` in your Laravel project directory. The package integrates as a Composer plugin, so no additional Laravel service provider or configuration is needed beyond the composer.json setup.
Which Laravel versions does this package support?
This package works with any Laravel version since it operates at the Composer level, not the framework level. It’s compatible with Laravel 5.8+ and newer, as long as your project uses Composer for dependency management.
Can I migrate existing Git hooks to this system?
Yes, you can manually define your existing hooks in the `extra.composer-git-hooks` section of your `composer.json`. The package will then manage them alongside your Composer dependencies, ensuring they’re version-controlled and reproducible across environments.
Does this work with CI/CD pipelines like GitHub Actions or GitLab CI?
Absolutely. Since hooks are defined in `composer.json`, they’ll run consistently in CI/CD pipelines when `composer install` or `composer update` is executed, enforcing your workflow rules in automated environments.
What if I need custom hooks beyond pre-commit or pre-push?
The package supports all standard Git hooks (e.g., `pre-receive`, `post-merge`, `prepare-commit-msg`). You can define them in `composer.json` under `extra.composer-git-hooks` with their respective script paths or commands.
Will this slow down `composer install` in Laravel?
Minimal impact. Hooks are only executed when explicitly triggered (e.g., `composer hooks:run`), not during every `composer install`. For Laravel projects, this is ideal—hooks run only when needed, like during development or CI checks.
How do I enforce hooks for the entire team?
Since hooks are versioned in `composer.json`, every team member gets the same hooks when they run `composer install`. This ensures consistency across all environments, from local dev to production staging.
Are there alternatives to this package for Laravel?
Yes, alternatives include `evilmartians/composer-hooks` or manual Git hook scripts. However, this package stands out by integrating natively with Composer, making it easier to manage hooks alongside Laravel’s dependency workflow.
Can I test hooks locally before committing to the project?
Yes, run `composer hooks:run [hook-name]` to test a specific hook locally. This is useful for debugging or verifying hooks work as expected before they’re committed to `composer.json`.
What happens if a hook fails in production?
Hook failures in production depend on your setup. For critical hooks (e.g., `pre-push`), you can configure them to exit with errors, blocking the Git operation. For non-critical hooks, log failures and continue to avoid disrupting deployments.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope