Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Whisky Laravel Package

projektgopher/whisky

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing Whisky as a dev dependency:

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

This creates a whisky.json file and symlinks hooks into .git/hooks/. The default setup includes pre-commit (for linting) and pre-push (for tests). For first-time use, verify your hooks are active by checking .git/hooks/, then run a simple git commit to confirm hooks fire as expected.

Implementation Patterns

  • Standard Workflow: Define checks in whisky.json as arrays of shell commands. Use relative paths or Composer scripts (e.g., "./vendor/bin/pint --dirty", "php artisan test").
  • Hook Arguments: For hooks like commit-msg that receive arguments, reference $1, $2, etc., escaped in double quotes: "npx -- commitlint --edit \"$1\"".
  • Team Enforcement: Add whisky update to composer.json’s post-install-cmd and post-update-cmd to auto-sync hooks on dependency changes.
  • Complex Logic: Move custom logic into executable scripts in a scripts/ directory (e.g., ./scripts/check-changesets.sh) and reference them directly. Ensure chmod +x is applied.
  • Testing Hooks in Isolation: Use git hook run pre-commit to validate hook behavior without making dummy commits.

Gotchas and Tips

  • Path Escaping: Spaces in paths caused issues pre-v0.7.4—ensure you’re on a recent patch (v0.7.4+). Avoid paths with special characters in hook commands.
  • Double Hook Execution: If hooks run twice, you likely have both global and local installations. Use whisky uninstall -n to remove global hooks while preserving whisky.json.
  • Disabled Hooks: Add hook names to "disabled": [] in whisky.json for temporary opt-outs (e.g., during feature branches), but avoid committing disables permanently.
  • Windows Compatibility: All recent versions (v0.4.0+) support Windows—ensure whisky.json uses forward slashes (/) in paths for portability.
  • Skip Hooks Safely: Use git commit --no-verify where supported; for non---no-verify actions (e.g., git merge --continue), run ./vendor/bin/whisky skip-once. Add a shell alias for brevity.
  • Validation: Run whisky validate to catch syntax errors in whisky.json before committing—especially important after editing manually.
  • Avoid Inline Escaping Pitfalls: Never embed dynamic user input directly in whisky.json commands; prefer static references to executable scripts to avoid injection or quoting errors.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport