PHPackages                             givanov95/laravel-git-hooks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. givanov95/laravel-git-hooks

ActiveComposer-plugin[Testing &amp; Quality](/categories/testing)

givanov95/laravel-git-hooks
===========================

Composer plugin that installs a pre-commit git hook into Laravel + Vite projects — runs php-cs-fixer, a debug-statement guard, the Vite build (on frontend changes) and the test suite before each commit. Bypass with --no-verify.

v1.1.1(1mo ago)01104MITPHPPHP ^8.2CI passing

Since May 26Pushed 3w agoCompare

[ Source](https://github.com/givanov95/laravel-git-hooks)[ Packagist](https://packagist.org/packages/givanov95/laravel-git-hooks)[ RSS](/packages/givanov95-laravel-git-hooks/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (4)Used By (4)

laravel-git-hooks
=================

[](#laravel-git-hooks)

A tiny **Composer plugin** that wires a `pre-commit` git hook into your Laravel + Vite projects. On every commit it runs your quality gate; if any step fails, the commit is aborted.

It is intentionally small and self-contained — one bash hook plus a few lines of PHP to install it. The hook is the authoritative source of truth, versioned in this package, so every project that requires it stays in sync.

> **Heads-up:** a local git hook is a *fast-feedback* gate, not a security boundary — it is trivially bypassed (`--no-verify`) and only runs for people who have it installed. Pair it with **CI (GitHub Actions)** for the real, enforced gate.

What the hook runs
------------------

[](#what-the-hook-runs)

Each step is skipped gracefully when its tooling isn't present, so the same hook works across projects with different setups:

1. **php-cs-fixer** — formats staged `*.php` files (needs `vendor/bin/php-cs-fixer` + a `.php-cs-fixer.php` / `.php-cs-fixer.dist.php` config), then re-stages them.
2. **Debug-statement guard** — blocks the commit if staged `*.php/*.vue/*.js/*.ts` files contain `console.log(`, `dd(` or `dump(`.
3. **Vite build** — runs `npm run build` **only when frontend files are staged** and a `build` script exists in `package.json`.
4. **Tests** — runs `php artisan test` (or `vendor/bin/phpunit`).

Installation
------------

[](#installation)

```
composer require --dev givanov95/laravel-git-hooks
```

That's it. The plugin installs the hook into `.git/hooks/pre-commit` after install/update. Because it's a plugin, Composer will ask you to trust it the first time (or add it to `allow-plugins` in your project's `composer.json`):

```
{
    "config": {
        "allow-plugins": {
            "givanov95/laravel-git-hooks": true
        }
    }
}
```

If a hand-written `pre-commit` already exists, it is backed up to `pre-commit.local.bak`.

### Manual install (plugins disabled)

[](#manual-install-plugins-disabled)

```
vendor/bin/laravel-git-hooks
```

Bypassing &amp; skipping
------------------------

[](#bypassing--skipping)

GoalHowSkip everything for one commit`git commit --no-verify`Skip every step (keep the hook)`SKIP_HOOK=1 git commit ...`Skip just the build`SKIP_BUILD=1 git commit ...`Skip just the tests`SKIP_TESTS=1 git commit ...`Skip php-cs-fixer`SKIP_CSFIXER=1 git commit ...`Requirements
------------

[](#requirements)

- PHP `^8.3`
- Composer `^2.0`
- Git, and (per step) `bash`, `npm`, your project's `php artisan` / `phpunit`

License
-------

[](#license)

MIT © Georgi Ivanov

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance95

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Total

3

Last Release

31d ago

Major Versions

v0.1.0 → v1.1.02026-05-26

PHP version history (2 changes)v0.1.0PHP ^8.3

v1.1.1PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/63155374?v=4)[givanov95](/maintainers/givanov95)[@givanov95](https://github.com/givanov95)

---

Top Contributors

[![givanov95](https://avatars.githubusercontent.com/u/63155374?v=4)](https://github.com/givanov95 "givanov95 (4 commits)")

---

Tags

phpunitlaravelqualitygithooksvitecomposer-pluginpre-commit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/givanov95-laravel-git-hooks/health.svg)

```
[![Health](https://phpackages.com/badges/givanov95-laravel-git-hooks/health.svg)](https://phpackages.com/packages/givanov95-laravel-git-hooks)
```

###  Alternatives

[captainhook/captainhook

PHP git hook manager

1.1k7.7M502](/packages/captainhook-captainhook)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
