PHPackages                             php-composter/php-composter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. php-composter/php-composter

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

php-composter/php-composter
===========================

Git Hooks Management through Composer.

v0.3.3(7y ago)10525.1k↓35.7%8[4 issues](https://github.com/php-composter/php-composter/issues)[2 PRs](https://github.com/php-composter/php-composter/pulls)11MITPHPPHP ^5.4 || ^7.0

Since Mar 24Pushed 4y ago7 watchersCompare

[ Source](https://github.com/php-composter/php-composter)[ Packagist](https://packagist.org/packages/php-composter/php-composter)[ RSS](/packages/php-composter-php-composter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (12)Used By (11)

Bright Nucleus PHP Composter
============================

[](#bright-nucleus-php-composter)

### Git Hooks Management through Composer.

[](#git-hooks-management-through-composer)

[![Latest Stable Version](https://camo.githubusercontent.com/64c5d56721569bad7b8fedac356f87ca6397fb5094c6f5e09134377f32542da3/68747470733a2f2f706f7365722e707567782e6f72672f7068702d636f6d706f737465722f7068702d636f6d706f737465722f762f737461626c65)](https://packagist.org/packages/php-composter/php-composter)[![Total Downloads](https://camo.githubusercontent.com/497f8f08fdc17ba2166e89eb542718a434cb03cf5f27cb5ddb4590e39b562559/68747470733a2f2f706f7365722e707567782e6f72672f7068702d636f6d706f737465722f7068702d636f6d706f737465722f646f776e6c6f616473)](https://packagist.org/packages/php-composter/php-composter)[![Latest Unstable Version](https://camo.githubusercontent.com/83951ffc7ad0fdbc82f40e732f3bdf39d900ee8566ef0f276647a9aef70aaf11/68747470733a2f2f706f7365722e707567782e6f72672f7068702d636f6d706f737465722f7068702d636f6d706f737465722f762f756e737461626c65)](https://packagist.org/packages/php-composter/php-composter)[![License](https://camo.githubusercontent.com/a5bbbd080381c87b81f5957e663978d6c75f14e0c0bed26832c97e972ab021cd/68747470733a2f2f706f7365722e707567782e6f72672f7068702d636f6d706f737465722f7068702d636f6d706f737465722f6c6963656e7365)](https://packagist.org/packages/php-composter/php-composter)

This is a Composer plugin that manages Git pre- &amp; post-hooks through Composer dependencies. Actions you want to be executed on Git hooks can simply be `require`d as `--dev` dependencies, and will immediately become active on `composer install`.

Introductory post: [Adding Git Hooks Through Composer Dev-Dependencies](https://www.alainschlesser.com/php-composter/)

Table Of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Existing PHP Composter Actions](#existing-php-composter-actions)
- [Creating a New PHP Composter Action](#creating-a-new-php-composter-action)
- [Using Existing PHP Composter Actions in Your Projects](#using-existing-php-composter-actions-in-your-projects)
- [Skipping Installation of PHP Composter Actions](#skipping-installation-of-php-composter-actions)
- [Contributing](#contributing)

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

[](#installation)

You should not need to install this package directly. It should come as a dependency of a package that is of type `php-composter-action`.

Existing PHP Composter Actions
------------------------------

[](#existing-php-composter-actions)

- **[PHP Composter PHPCS PSR2](https://github.com/php-composter/php-composter-phpcs-psr2)**

    > Check your PHP source code for PSR-2 compliance before committing.
- **[PHP Composter Regular Expression](https://github.com/php-composter/php-composter-regular-expression)**

    > Check your commit messages against a regular expression pattern, to enforce a commit message standard.
- **[PHP Composter PHPCS WordPress](https://github.com/php-composter/php-composter-phpcs-wpcs)**

    > Check your PHP source code for WordPress Coding Standards compliance before committing.
    >
    > Thanks to [Gabor Javorszky](https://github.com/javorszky) for contributing this action.
- **[PHP Composter PHPCS Drupal](https://github.com/NickWilde1990/php-composter-phpcs-drupal)**

    > Check your source code for Drupal Coding Standards compliance before committing.
    >
    > Action by [Nick Wilde](https://github.com/NickWilde1990).
- **PHP Composter PHPUnit** *(coming soon)*

    > Run a PHPUnit test suite before committing.
- **PHP Composter PHP Syntax Checker** *(coming soon)*

    > Validate the PHP syntax before committing.

Creating a New PHP Composter Action
-----------------------------------

[](#creating-a-new-php-composter-action)

To build a new PHP Composter action, you need to proceed as follows:

1. [Create a Composer Package with a Valid Name](#create-a-composer-package-with-a-valid-name)
2. [Extend `BaseAction` class](#extend-baseaction-class)
3. [Add Public Methods](#add-public-methods)
4. [Add the Class to Composer Autoloader](#add-the-class-to-composer-autoloader)
5. [Set the Composer Package Type to `php-composter-action`](#set-the-composer-package-type-to-php-composter-action)
6. [Add `php-composter/php-composter` as a dependency](#add-php-composter-php-composter-as-a-dependency)
7. [Configure Git Hooks through Composer Extra key](#configure-git-hooks-through-composer-extra-key)

### Create a Composer Package with a Valid Name

[](#create-a-composer-package-with-a-valid-name)

Create a new Composer package with the following naming pattern: `/php-composter-`

**Example:**

```
composer init --name php-composter/php-composter-example
```

### Extend `BaseAction` class

[](#extend-baseaction-class)

Create a new class that `extends PHPComposter\PHPComposter\BaseAction`.

**Example:**

```
