Volver al ranking

captainhookphp/captainhook

PHPcaptainhook.info

CaptainHook is a very flexible git hook manager for software developers that makes sharing git hooks with your team a breeze.

phpgitgit-hookshacktoberfestautomationcode-quality
Crecimiento de estrellas
Estrellas
1k
Forks
89
Crecimiento semanal
Issues
7
5001k
ene 2023jun 2023nov 2023may 2024
ArtefactosPackagistcomposer require captainhookphp/captainhook
README

Latest Stable Version PHP Version Downloads Downloads Downloads License Build Status Code Quality Code Coverage X Mastodon

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

The preferred method to install CaptainHook is to install the PHAR file. You can do so by using Phive, use the PHAR Composer package, or download the PHAR from the GitHub release page.

phive install captainhook

Or use Composer to install it.

composer require --dev captainhook/captainhook-phar

If you want to get the source code with all its dependencies you can use:

composer require --dev captainhook/captainhook

Setup

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

vendor/bin/captainhook configure

After creating the captainhook.json configuration file you have to activate the hooks by installing them to your local .git directory. To do so just run the following CaptainHook command.

vendor/bin/captainhook install

Have a look at this short installation video.

Install demo

One of the goals of CaptainHook is to make it easy for a team to use the same git hooks. If you want to make sure everybody actually installs the hooks you can use the small Composer plugin hook-installer. It runs the captainhook install command everytime you run a Composer command.

composer require --dev captainhook/hook-installer

Off course teammates can still commit without executing the hooks, that's why you should run appropriate checks on the backend as well. But at least this way nobody can forget to install them "by accident".

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": []
  }
}

Documentation

The full documentation can be found at php.captainhook.info.

Contributing

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

Have a look at the contribution guidelines.

Repositorios relacionados
laravel/laravel

Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.

Bladephpframework
laravel.com
84.6k24.8k
coollabsio/coolify

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 280+ one-click services on your own servers.

PHPPackagistApache License 2.0nodejsmysql
coolify.io
59.2k5.1k
LeCoupa/awesome-cheatsheets

👩‍💻👨‍💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.

JavaScriptnpmMIT Licensecheatsheetsjavascript
lecoupa.github.io/awesome-cheatsheets/
46.2k6.7k
nextcloud/server

☁️ Nextcloud server, a safe home for all your data

PHPPackagistGNU Affero General Public License v3.0open-sourcefile-sharing
nextcloud.com
36.2k5.1k
laravel/framework

Laravel is a web application framework with expressive, elegant syntax.

PHPPackagistMIT Licensephpframework
laravel.com
34.8k11.9k
ziadoz/awesome-php

A curated list of amazingly awesome PHP libraries, resources and shiny things.

Do What The F*ck You Want To Public Licensephpphp-framework
32.6k5.1k
symfony/symfony

The Symfony PHP framework

PHPPackagistMIT Licenseframeworkphp
symfony.com
31.1k9.8k
composer/composer

Dependency Manager for PHP

PHPPackagistMIT Licensephpcomposer
getcomposer.org
29.5k4.8k
bagisto/bagisto

Free and open source laravel eCommerce platform

PHPPackagistMIT Licenseecommerce-frameworklaravel
bagisto.com
27.8k3.2k
monicahq/monica

Personal CRM. Remember everything about your friends, family and business relationships.

PHPPackagistGNU Affero General Public License v3.0laravelcrm
beta.monicahq.com
24.9k2.6k
firefly-iii/firefly-iii

Firefly III: a personal finances manager

PHPPackagistGNU Affero General Public License v3.0phpmoney
firefly-iii.org
24.1k2.2k
guzzle/guzzle

Guzzle, an extensible PHP HTTP client

PHPPackagistMIT Licenseguzzlepsr-7
23.5k2.4k