nocturnal/pre-commit-guard 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

nocturnal/pre-commit-guard

最新稳定版本:v1.0.0

Composer 安装命令:

composer require nocturnal/pre-commit-guard

包简介

Git pre-commit guard for Laravel apps (Pint, PHPStan, etc.)

README 文档

README

A Laravel package that helps enforce code quality checks before commits using Git hooks.

Installation

1. Require the Package

# For development (using path/VCS)
composer config repositories.pre-commit-guard '{"type":"path","url":"../pre-commit-guard","options":{"symlink": true}}'
composer require --dev nocturnal/pre-commit-guard nunomaduro/larastan

2. Remove Ad-Hoc Hook Installer (if any)

If you currently use custom hook installation scripts like:

  • post-install-cmd: ["@setup-dev-hooks"]
  • "setup-dev-hooks": ["@php install-dev-hooks.php"]

You can remove them as this package provides a more robust solution.

3. Publish and Install Hooks

php artisan vendor:publish --tag=pre-commit-guard --force
php artisan precommit:install --force

Usage

After installation, the Git pre-commit hook will automatically run Pint and PHPStan checks when you make a commit. The commit will be blocked if any of these checks fail.

Configuration

Presets

  • Pint configuration and rules are included in the stubs and will be inherited by consuming projects.
  • PHPStan configuration is also included in the stubs for consistent code quality checks.

Your existing Pint preset and rules will be preserved when installing this package.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-14