承接 givanov95/laravel-git-hooks 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

givanov95/laravel-git-hooks

Composer 安装命令:

composer require 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.

README 文档

README

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

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

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)

vendor/bin/laravel-git-hooks

Bypassing & skipping

Goal How
Skip 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

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

License

MIT © Georgi Ivanov

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固