PHPackages                             96solutions/toolbox - 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. 96solutions/toolbox

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

96solutions/toolbox
===================

PHP git hook manager

v1.0.0(3d ago)00MITPHPPHP &gt;=8.4CI passing

Since Mar 19Pushed 2d agoCompare

[ Source](https://github.com/96solutions/toolbox)[ Packagist](https://packagist.org/packages/96solutions/toolbox)[ RSS](/packages/96solutions-toolbox/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (2)Used By (0)

96solutions/toolbox
===================

[](#96solutionstoolbox)

A PHP library that provides interactive Composer scripts to install and configure Git pre-commit hooks.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4
- Composer 2

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

[](#installation)

```
composer require 96solutions/toolbox
```

Usage
-----

[](#usage)

Add the hook installer to your project's `composer.json` scripts:

```
{
    "scripts": {
        "install-hooks": "nssolutions\\Toolbox\\Scripts\\InstallHooks::install"
    }
}
```

Run whenever you want to set up or reconfigure the pre-commit hook:

```
composer run install-hooks
```

The script is **interactive** — it will guide you through selecting which tools to enable and configuring options for each one.

How it works
------------

[](#how-it-works)

1. Looks for `.git/hooks/` in the project root. If not found, asks you to provide the path or exits gracefully.
2. Presents an interactive menu to select which tools to install (e.g. PHPStan, EasyCodingStandard).
3. For each selected tool, prompts for relevant options (paths, levels, config files, etc.).
4. If a pre-commit hook already exists, asks whether to overwrite, back it up, or cancel.
5. Writes a PHP script (`pre-commit`) into `.git/hooks/` and makes it executable.

The generated hook is a PHP CLI script (`#!/usr/bin/env php`) that resolves staged PHP files at runtime and runs each configured tool against them, exiting on the first failure.

Available tools
---------------

[](#available-tools)

ToolDescriptionPHPStanStatic analysis at a configurable levelEasyCodingStandardCode style checks with a configurable config fileExtensibility
-------------

[](#extensibility)

The library is designed to be extended with additional tools. Each tool is a self-contained class implementing `ToolInterface`, responsible for its interactive configuration and hook command generation.

### Project structure

[](#project-structure)

```
src/
├── Scripts/InstallHooks.php       # Composer script entry point — orchestrates the interactive flow
├── Tools/
│   ├── ToolInterface.php          # Contract: getName(), configure(), getCommand(), isConfigured()
│   ├── PhpStan.php                # Prompts for level and paths, resolves vendor/bin/phpstan
│   └── EasyCodingStandard.php    # Prompts for config file path, resolves vendor/bin/ecs
└── Hook/
    ├── HookRenderer.php           # Builds the PHP pre-commit script from configured tools
    ├── HookWriter.php             # Resolves hooks dir, handles conflicts, writes + chmod 0755
    └── StagedFiles.php            # Shell expression helpers for staged file resolution

```

Development
-----------

[](#development)

### Setup

[](#setup)

```
composer install
```

### Run in Docker (PHP 8.4)

[](#run-in-docker-php-84)

```
docker build -t toolbox-php84 .docker/php8.4
docker run --rm -v $(pwd):/app toolbox-php84 composer install
docker run --rm -v $(pwd):/app toolbox-php84 vendor/bin/phpunit
```

### Code style

[](#code-style)

```
vendor/bin/ecs check src
vendor/bin/ecs check src --fix
```

### Static analysis

[](#static-analysis)

```
vendor/bin/phpstan analyse src
```

### Tests

[](#tests)

```
vendor/bin/phpunit
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

TODO
----

[](#todo)

- non-blocking scripts execution
- add the ability to select hooks to install
- add a security check script
- add the ability to run scripts in docker containers
- improve readme
- - add a screenshot
- - add links to repository &amp; Packagist
- - add badges

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance99

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

3d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fef41430dfbf022c2743db714815e93f6976f34655fbbb591e68c673040db84?d=identicon)[96solutions](/maintainers/96solutions)

---

Top Contributors

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

---

Tags

githookspre-commitpost-commit

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/96solutions-toolbox/health.svg)

```
[![Health](https://phpackages.com/badges/96solutions-toolbox/health.svg)](https://phpackages.com/packages/96solutions-toolbox)
```

###  Alternatives

[captainhook/captainhook

PHP git hook manager

1.1k6.5M297](/packages/captainhook-captainhook)[ramsey/conventional-commits

A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

1941.1M102](/packages/ramsey-conventional-commits)[bernardosilva/git-hooks-php

Composer git-hook package with hooks for your php projects.

2516.7k](/packages/bernardosilva-git-hooks-php)[wcm/git-php-hooks

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

6440.6k3](/packages/wcm-git-php-hooks)[felipebool/crook

Crook is a simple tool to ease your life when dealing with git hooks

5813.7k](/packages/felipebool-crook)[igorsgm/laravel-git-hooks

🪝• Efficiently manage Git hooks in Laravel projects. Enhance code quality, save time on reviews, and prevent bugs from entering your repository.

2929.1k1](/packages/igorsgm-laravel-git-hooks)

PHPackages © 2026

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