Download the PHP package php-composter/php-composter without Composer
On this page you can find all versions of the php package php-composter/php-composter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download php-composter/php-composter
More information about php-composter/php-composter
Files in php-composter/php-composter
Package php-composter
Short Description Git Hooks Management through Composer.
License MIT
Informations about the package php-composter
Bright Nucleus PHP Composter
Git Hooks Management through Composer.
This is a Composer plugin that manages Git pre- & 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
Table Of Contents
- Installation
- Existing PHP Composter Actions
- Creating a New PHP Composter Action
- Using Existing PHP Composter Actions in Your Projects
- Skipping Installation of PHP Composter Actions
- Contributing
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
-
Check your PHP source code for PSR-2 compliance before committing.
-
PHP Composter Regular Expression
Check your commit messages against a regular expression pattern, to enforce a commit message standard.
-
Check your PHP source code for WordPress Coding Standards compliance before committing.
Thanks to Gabor Javorszky for contributing this action.
-
Check your source code for Drupal Coding Standards compliance before committing.
Action by Nick Wilde.
-
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
To build a new PHP Composter action, you need to proceed as follows:
- Create a Composer Package with a Valid Name
- Extend
BaseAction
class - Add Public Methods
- Add the Class to Composer Autoloader
- Set the Composer Package Type to
php-composter-action
- Add
php-composter/php-composter
as a dependency - Configure Git Hooks through Composer Extra key
Create a Composer Package with a Valid Name
Create a new Composer package with the following naming pattern: <vendor>/php-composter-<action intent>
Example:
Extend BaseAction
class
Create a new class that extends PHPComposter\PHPComposter\BaseAction
.
Example:
Add Public Methods
PHP Composter allows you to attach PHP methods to Git hooks. These methods need to be publicly accessible, so that they can be called by the PHP-Composter bootstrapping script.
Example:
Set the Composer Package Type to php-composter-action
You need to set the type of your Composer package in your composer.json
file to php-composter-action
.
Example:
Add the Class to Composer Autoloader
Composer's Autoloader will be initialized for each Git hook, so make sure you've registered your newly created class correctly.
Example:
Add php-composter/php-composter
as a dependency
You need to set the type of your Composer package in your composer.json
file to php-composter-action
.
Example:
Configure Git Hooks through Composer Extra key
Finally, add a new entry "php-composter-hooks"
to the extra
key in the package's composer.json
to attach each of your methods to a specific Git hook.
Example:
Hooks can either be "<priority>.<git-hook-name>"
, or just "<git-hook-name>"
.
In the above example, the priority is 20
. It defaults to 10 if omitted. Lower priority numbers get executed before higher ones.
Supported Git Hooks:
applypatch-msg
pre-applypatch
post-applypatch
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-rebase
post-checkout
post-merge
post-update
pre-auto-gc
post-rewrite
pre-push
Using Existing PHP Composter Actions in Your Projects
To use an existing PHP Composter Action in your projects, simply require
them as --dev
dependencies:
Anyone using Composer to pull in the development dependencies will automatically have your PHP Composter Actions installed into their .git
.
Skipping Installation of PHP Composter Actions
In case you want to install your the Composer dependencies of a project without activating the PHP Composter system, you can run Composer with the --no-plugins
option:
Contributing
All feedback / bug reports / pull requests are welcome.
All versions of php-composter with dependencies
composer/installers Version ^1
composer/composer Version ^1
composer-plugin-api Version ^1