Code Monkey home page Code Monkey logo

husky-php's Introduction

PHP Husky 🐺

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

PHP is combined with composer to implement functionality similar to js's NPM module husky

Git hooks made easy

Husky can prevent bad git commit, git push and more git's hooks

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Branch

  • v5.6-7.3.x => "ccinn/husky-php": "^0.1.0"
  • v7.4 => "ccinn/husky-php": "^0.2.0"
  • v8.0.0 => "ccinn/husky-php": "^0.4.0"

Install

In composer.json

    "require-dev": {
        "ccinn/composer-husky-plugin": "^0.1.0",
        "ccinn/husky-php": "^0.4.0"
    },

Or

In Shell

composer require --dev ccinn/composer-husky-plugin ccinn/husky-php

Docker

docker build --build-arg PHP_VERION=8.0.9 -t husky-php .

Usage

you can also configure hooks using .huskyrc or .huskyrc.json file.

// .huskyrc or .huskyrc.json
{
  "hooks": {
    "pre-commit": "echo 'husky-php-pre-commit'",
    "pre-push": "echo 'husky-php-pre-push'",
    "...": "..."
  }
}

Running the git action hooks will be triggered

git commit -m 'Keep calm and commit'

You will see

husky-php-pre-commit

Default

By default, the pre - commit

Default support features:

  1. Detect code conflicts

  2. Test code specifications

  3. Check code syntax

Window User

You need run in bash environment, for example:GitBash

husky-php's People

Contributors

idleberg avatar pawel-grzona avatar trusted97 avatar whiteccinn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

husky-php's Issues

Library improvements

Hello @whiteCcinn
Thanks for your amazing work! I have ideas on how to evolve and improve the library:

  • Dockerized container with different versions of PHP 8.X
  • Testing via PHPUnit
  • CI/CD via Github Actions
  • Symfony 6.x support
  • Typing

Would you like to receive PR?

Best regards

support symfony/filesystem 6

Im trying to use this package with Magento 2.4.5 but get the following error:

ccinn/husky-php v0.3.1 requires symfony/filesystem ^3.4|^4|^5 -> found symfony/filesystem[v3.4.0, ..., v3.4.47, v4.0.0, ..., v4.4.42, v5.0.0, ..., v5.4.13] but the package is fixed to v6.1.5 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Issue with pre-commit default hook

I want to change the behavior of the pre-commit hook, but no matter what I put in my .huskyrc file, it always runs the default pre-commit script.

I started digging into it and I think its due to this:

if (json_last_error() === JSON_ERROR_NONE) {
  $this->conf = array_merge($this->conf, $userConf);
}

The documentation states that the huskyrc file should look like this:

{
  "husky": {
    "hooks": {
      "post-merge": "composer install --no-dev",
      "pre-commit": "echo 'test'"
    }
  }
}

But the default is stored like this:

protected $conf = [
        'hooks' => [
            'pre-commit' => 'husky-default-pre-commit',
        ]
    ];

So the resulting array that the RunServices::execute method loops over looks like this:

Array
(
    [hooks] => Array
        (
            [pre-commit] => vendor/ccinn/husky-php/sh/husky-default-pre-commit
        )

    [husky] => Array
        (
            [hooks] => Array
                (
                    [post-merge] => composer install --no-dev
                    [pre-commit] => echo 'test'
                )

        )

)

I'm looking for clarification on which way is correct. If the documentation should just be updated or if we should fix the package

PHP 7.4 support

Using with PHP 7.4 produces the following message:

"PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.3.*."

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.