PHPackages                             rugaard/git-hooks-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rugaard/git-hooks-php

ActiveGit-hook[Utility &amp; Helpers](/categories/utility)

rugaard/git-hooks-php
=====================

PHP related Git hooks.

1.0.0(4y ago)074MITPHPPHP ^8.0

Since Feb 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rugaard/git-hooks-php)[ Packagist](https://packagist.org/packages/rugaard/git-hooks-php)[ Docs](https://github.com/rugaard)[ RSS](/packages/rugaard-git-hooks-php/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

🪝 Git Hooks for PHP [![GitHub Actions (tests)](https://github.com/rugaard/git-hooks-php/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/rugaard/git-hooks-php/actions/workflows/tests.yml)
=================================================================================================================================================================================================================

[](#-git-hooks-for-php-)

This is a "plugin" package which seamlessly integrates with the [Git Hooks](https://github.com/rugaard/git-hooks) package.

It will install `git` hooks, that will automatically run multiple checks on your projects PHP files, to make sure they do not contain errors and follow the expected coding standards.

📦 Installation
--------------

[](#-installation)

You install the package via [Composer](https://getcomposer.org/) by using the following command:

```
composer require rugaard/git-hooks rugaard/git-hooks-php
```

📝 Configuration
---------------

[](#-configuration)

To change the default configuration of one or more script, you need to have a `git-hooks.config.json` file in your project root. If you don't, you can create it with the following command:

```
./vendor/bin/git-hooks config
```

### `Rugaard\GitHooks\PHP\Hooks\PreCommit\PhpCodeStyleCommand`

[](#rugaardgithooksphphooksprecommitphpcodestylecommand)

Checks all staged `.php` files for coding style errors.

ParameterDescriptionDefault`encoding`Encoding of the files being checked`utf-8``hideWarnings`Hide code style warnings`true``onlyStaged`Only check code style on staged PHP files.`true``paths`Paths to directories/files that should be checked. *Only used when `onlyStaged` is set to `false`*.`[]``config`Path to custom configuration file.`null`**Note:** By default, if a valid `config` has not been provided, this command will look for `phpcs.xml` or `phpcs.xml.dist` as an alternative.

If it finds any of those options, the above paramters will be ignored, and the configuration file will take priority.

### `Rugaard\GitHooks\PHP\Hooks\PreCommit\PhpLintCommand`

[](#rugaardgithooksphphooksprecommitphplintcommand)

Checks all staged `.php` files for syntax errors.

***Script has nothing to configure***

### `Rugaard\GitHooks\PHP\Hooks\PreCommit\PhpStaticAnalysisCommand`

[](#rugaardgithooksphphooksprecommitphpstaticanalysiscommand)

Statically analyzes all (or staged) `.php` files for errors.

ParameterDescriptionDefault`level`Level of strictness to use. From `0` to `9`.`8``onlyStaged`Only analyze staged PHP files.`true``paths`Only the following directories/files should be checked.`[]``memory-limit`Set memory limit of process. Fx. `512M` for 512 MB.`null``config`Path to custom configuration file.`null`**Note:** By default, if a valid `config` has not been provided, this command will look for `phpstan.neon` or `phpstan.neon.dist` as an alternative.

If it finds any of those options, the above paramters will be ignored, and the configuration file will take priority.

### `Rugaard\GitHooks\PHP\Hooks\PrePush\PhpTestSuiteCommand`

[](#rugaardgithooksphphooksprepushphptestsuitecommand)

Runs the projects test suite(s).

ParameterDescriptionDefault`driver`Application to run test suite(s). Supports: `phpunit` or `pest`\*`phpunit``printer`Change printer used by `driver` application`\\NunoMaduro\\Collision\\Adapters\\Phpunit\\Printer``config`Path to custom configuration file`null`*\* Requires `pest` to be installed in your project*

**Note:** By default, if a valid `config` has not been provided, this command will look for `phpunit.xml` or `phpunit.xml.dist` as an alternative.

If it finds any of those options, the above paramters will be ignored, and the configuration file will take priority.

🚓 License
---------

[](#-license)

This package is licensed under [MIT](https://github.com/rugaard/git-hooks-php/blob/main/LICENSE).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

1551d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1007ed23e51422c83de722371145b5bfcb0e57199befa00a441f734af903c77?d=identicon)[rugaard](/maintainers/rugaard)

---

Top Contributors

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

---

Tags

phpplugincomposergithookscomposer-plugingit-hooksrugaardmortenmorten rugaardphp git hooks

### Embed Badge

![Health badge](/badges/rugaard-git-hooks-php/health.svg)

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

###  Alternatives

[liborm85/composer-vendor-cleaner

Composer Vendor Cleaner removes unnecessary development files and directories from vendor directory.

35342.7k1](/packages/liborm85-composer-vendor-cleaner)[wcm/git-php-hooks

Write git hooks with PHP, organize them on a per-project base and automatically add them

6441.1k3](/packages/wcm-git-php-hooks)[wcm/git-php-hooks-library

A collection of Git PHP Hooks

1210.1k3](/packages/wcm-git-php-hooks-library)[opengento/composer-registration-plugin

This plugin allows to compile the Magento2 components registrations on composer install/update.

111.6k](/packages/opengento-composer-registration-plugin)

PHPackages © 2026

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