PHPackages                             projektgopher/whisky - 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. [CLI &amp; Console](/categories/cli)
4. /
5. projektgopher/whisky

ActiveProject[CLI &amp; Console](/categories/cli)

projektgopher/whisky
====================

A simple CLI tool for managing a project's git hooks across multiple members.

v0.7.4(1y ago)241281.3k—1.1%11[3 issues](https://github.com/ProjektGopher/whisky/issues)[3 PRs](https://github.com/ProjektGopher/whisky/pulls)17MITPHPPHP ^8.1CI passing

Since May 18Pushed 1y ago5 watchersCompare

[ Source](https://github.com/ProjektGopher/whisky)[ Packagist](https://packagist.org/packages/projektgopher/whisky)[ Docs](https://github.com/ProjektGopher/whisky)[ RSS](/packages/projektgopher-whisky/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (25)Used By (17)

[![Whisky Logo](https://github.com/ProjektGopher/whisky/raw/HEAD/art/logo.svg)](https://github.com/ProjektGopher/whisky/raw/HEAD/art/logo.svg)

[![Whisky Terminal Example](https://github.com/ProjektGopher/whisky/raw/HEAD/art/example.png)](https://github.com/ProjektGopher/whisky/raw/HEAD/art/example.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/32a471d00737132223f284c94104542b7897ed1ccbc9f0ee61794bd6ebd7684c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70726f6a656b74676f706865722f776869736b792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/projektgopher/whisky)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c6f9768bafbfeef8766f427514f67ad9758695fedf3f6f05ab8a875bc01575ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70726f6a656b74676f706865722f776869736b792f746573742e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/projektgopher/whisky/actions?query=workflow%3Atest+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c22f6e2189dff26989cee4d884a48787ceefc2a3c54a8515e359d2589de95868/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70726f6a656b74676f706865722f776869736b792f70696e742e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/projektgopher/whisky/actions?query=workflow%3Apint+branch%3Amain)[![GitHub Static Analysis Action Status](https://camo.githubusercontent.com/0d51fcdd11f480938986733c11c097f2f32a4193bef22d131f6ed661486ae68e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70726f6a656b74676f706865722f776869736b792f6c6172617374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d737461746963253230616e616c79736973267374796c653d666c61742d737175617265)](https://github.com/projektgopher/whisky/actions?query=workflow%3Alarastan+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/49dbef6dcd6e0bbbfb05e7c9c2209bd132c036baaf9d121bcf7cfc5b3530d3c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70726f6a656b74676f706865722f776869736b792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/projektgopher/whisky)

Introduction
------------

[](#introduction)

Whisky is the simplest, **framework agnostic**, CLI tool for managing and enforcing a php project's git hooks across an entire team.

Git hooks are a fantastic tool to ensure that code hitting version control satisfies your org's code quality standards. However, `.git/hooks` is not included in your git tree. This makes it impractical to have all contributors to a repository use the same checks with the same settings.

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

[](#installation)

Whisky's **only** dependency is `php^8.1`.

You can install the package via composer:

```
composer require --dev projektgopher/whisky
./vendor/bin/whisky install
```

This is the recommended method, as every developer on your project will have access to the tool.

### Global Installation

[](#global-installation)

Whisky can be installed globally, however this means that any developer on your project will *also* need it installed globally if they want to use it.

```
composer global require projektgopher/whisky
whisky install
```

If Whisky is installed both globally, and locally, on a project the version that's run will depend on how the command is invoked.

Usage
-----

[](#usage)

The `install` command will create a `whisky.json` file in your project root:

```
// whisky.json
{
  "disabled": [],
  "hooks": {
    "pre-commit": [
      "./vendor/bin/pint --dirty"
    ],
    "pre-push": [
      "php artisan test"
    ]
  }
}
```

For a complete list of supported git hooks, see the [Git Documentation](https://git-scm.com/docs/githooks#_hooks).

Caution

all hooks are **evaluated as-is** in the terminal. Keep this in mind when committing anything involving changes to your `whisky.json`.

Adding or removing any **hooks** (*not* individual commands) to your `whisky.json` file should be followed by `./vendor/bin/whisky update` to ensure that these changes are reflected in your `.git/hooks` directory.

### Working With Hook Arguments

[](#working-with-hook-arguments)

Some hooks in git are passed arguments.

The `commit-msg` hook is a perfect example. It's passed the path to git's temporary file containing the commit message, which can then be used by scripts like npm's [commitlint](https://commitlint.js.org/) to allow or prevent commit messages that might not conform to your project's standards.

To use this argument that git passes, you can *optionally* include `$1` in your array of commands. (You should wrap it in escaped double quotes to prevent odd behavior due to whitespace)

```
// whisky.json
// ...
  "commit-msg": [
    "npx --no -- commitlint --edit \"$1\""
  ]
// ...
```

Important

For `commitlint` specifically, you'll need to follow the instructions in their [documentation](https://commitlint.js.org/guides/getting-started.html), as it will require extra packages and setup to run in your project.

### Automating Hook Updates

[](#automating-hook-updates)

While we suggest leaving Whisky as an 'opt-in' tool, by adding a couple of Composer scripts we can *ensure* consistent git hooks for all project contributors. This will **force** everyone on the project to use Whisky:

```
// composer.json
// ...
  "scripts": {
    "post-install-cmd": [
      "whisky update"
    ],
    "post-update-cmd": [
      "whisky update"
    ]
  }
// ...
```

### Skipping Hooks

[](#skipping-hooks)

Sometimes you need to commit or push changes without running your git hooks, like when handing off work to another computer. This can usually be done using git's *native* `--no-verify` flag.

```
git commit -m "wip" --no-verify
```

However, some git actions don't support this flag, like `git merge --continue`. In this case, running the following command will have the exact same effect.

```
./vendor/bin/whisky skip-once
```

Tip

by adding `alias whisky=./vendor/bin/whisky` to your `bash.rc` file, you can shorten the length of this command.

### Disabling Hooks

[](#disabling-hooks)

Adding a hook's name to the `disabled` array in your `whisky.json` will disable the hook from running. This can be useful when building out a workflow that isn't ready for the rest of the team yet.

Advanced Usage
--------------

[](#advanced-usage)

For anything more complicated than simple terminal commands it's recommended to create a `scripts` directory in your project root. This comes with the added benefit of allowing you to run scripts written in *any* language.

```
// whisky.json
// ...
  "pre-push": [
    "composer lint",
    "rustc ./scripts/complicated_thing.rs"
  ]
// ...
```

Note

When doing this, make sure any scripts referenced are **executable**:

```
chmod +x ./scripts/*
```

Testing
-------

[](#testing)

```
# Run test suite
composer test

# Test hook without having to make a dummy commit
git hook run pre-commit
```

Troubleshooting
---------------

[](#troubleshooting)

If you've installed Whisky **both** locally **and** globally, and your hooks are being run *twice*, try uninstalling whisky from your hooks for **one** of those installations.

```
# Remove global Whisky hooks, leaving the local ones,
# while keeping `whisky.json` in the project root.
whisky uninstall -n
```

Contributing
------------

[](#contributing)

Note

Don't build the binary when contributing. The binary will be built when a release is tagged.

Please see [CONTRIBUTING](CONTRIBUTING.md) for more details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

A **big** "Thank You" to [EXACTsports](https://github.com/EXACTsports) for supporting the development of this package.

- [Len Woodward](https://github.com/ProjektGopher)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance45

Moderate activity, may be stable

Popularity53

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.1% 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 ~30 days

Recently: every ~74 days

Total

23

Last Release

429d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/63312522f1920cf5b3c34ea474511a484162b36166a33ae4b9fde6c65ab2c2fc?d=identicon)[ProjektGopher](/maintainers/ProjektGopher)

---

Top Contributors

[![ProjektGopher](https://avatars.githubusercontent.com/u/1688608?v=4)](https://github.com/ProjektGopher "ProjektGopher (89 commits)")[![faissaloux](https://avatars.githubusercontent.com/u/60013703?v=4)](https://github.com/faissaloux "faissaloux (6 commits)")[![gpibarra](https://avatars.githubusercontent.com/u/21188012?v=4)](https://github.com/gpibarra "gpibarra (4 commits)")[![sebastianstucke87](https://avatars.githubusercontent.com/u/47354551?v=4)](https://github.com/sebastianstucke87 "sebastianstucke87 (1 commits)")[![us3r001](https://avatars.githubusercontent.com/u/83162691?v=4)](https://github.com/us3r001 "us3r001 (1 commits)")

---

Tags

phpclilaraveldevgithooksProjektGopherwhisky

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/projektgopher-whisky/health.svg)

```
[![Health](https://phpackages.com/badges/projektgopher-whisky/health.svg)](https://phpackages.com/packages/projektgopher-whisky)
```

###  Alternatives

[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k48](/packages/nunomaduro-laravel-console-menu)[renoki-co/php-helm

PHP Helm Processor is a process wrapper for Kubernetes' Helm v3 CLI. You can run programmatically Helm v3 commands, directly from PHP, with a simple syntax.

1310.5k](/packages/renoki-co-php-helm)

PHPackages © 2026

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