Code Monkey home page Code Monkey logo

captainhook's Introduction

Latest Stable Version Minimum PHP Version Downloads License Build Status Scrutinizer Code Quality Code Coverage Twitter

CaptainHook

CaptainHook logo

CaptainHook is an easy to use and very flexible git hook library for php developers. It enables you to configure your git hook actions in a simple json file.

You can use CaptainHook to validate or prepare your commit messages, ensure code quality or run unit tests before you commit or push changes to git. You can automatically clear local caches or install the latest composer dependencies after pulling the latest changes.

CaptainHook makes it easy to share hooks within your team and even can make sure that everybody in your team activates the hooks locally.

You can run cli commands, use some built in validators, or write your own PHP classes that get executed by CaptainHook. For more information have a look at the documentation.

Installation

Install the CaptainHook PHAR using Phive or download the PHAR from the github release page.

phive install captainhook

Or use Composer to install CaptainHook.

composer require --dev captainhook/captainhook

Setup

After installing CaptainHook you can use the captainhook executable to create a configuration.

vendor/bin/captainhook configure

Now there should be a captainhook.json configuration file.

Now you have to activate the hooks by installing them to your local .git repository. To do so just run the following captainhook command.

vendor/bin/captainhook install

Have a look at this short installation video.

Install demo

If you want to make sure your whole team uses the same hooks, and you want to make sure everybody has the hooks installed you can add the following scripts command to your composer.json file.

{
  "scripts": {
    "post-autoload-dump": "vendor/bin/captainhook install -f -s"
  }
}

Configuration

Here's an example captainhook.json configuration file.

{
  "commit-msg": {
    "enabled": true,
    "actions": [
      {
        "action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
      }
    ]
  },
  "pre-commit": {
    "enabled": true,
    "actions": [
      {
        "action": "phpunit"
      },
      {
        "action": "phpcs --standard=psr2 src"
      }
    ]
  },
  "pre-push": {
    "enabled": false,
    "actions": []
  }
}

Contributing

So you'd like to contribute to the CaptainHook library? Excellent! Thank you very much. I can absolutely use your help.

Have a look at the contribution guidelines.

captainhook's People

Contributors

sebastianfeldmann avatar ramsey avatar fxedel avatar alexandrmazur96 avatar be-heiglandreas avatar localheinz avatar icanhazstring avatar iherak avatar heiglandreas avatar peter279k avatar raphaelstolt avatar pyrokar avatar wirone avatar purplebooth avatar aboks avatar iquito avatar bcremer avatar ruscon avatar davidjeddy avatar glensc avatar boesing avatar technicky24 avatar norgeindian avatar spajxo avatar shochdoerfer avatar hoogi91 avatar oesteve avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.