|
| 1 | +# PHP Commitizen |
| 2 | + |
| 3 | +[](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/?branch=master) |
| 4 | +[](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/?branch=master) |
| 5 | +[](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/build-status/master) |
| 6 | + |
| 7 | +Commitizen is a tool built for create good commits for a clean and readable git history. |
| 8 | + |
| 9 | +This tool follow the [Conventional Commit specs](https://conventionalcommits.org/) and some best practices described in [this slides](https://slides.com/damianopetrungaro/working-with-git) |
| 10 | + |
| 11 | +# Installation and usage |
| 12 | + |
| 13 | +You can install it easily with composer |
| 14 | + |
| 15 | +`$ php composer.phar require --dev damianopetrungaro/php-commitizen` |
| 16 | + |
| 17 | +Usage is simple too |
| 18 | + |
| 19 | +`$ php vendor/bin/php-commitizen commit` |
| 20 | + |
| 21 | +You can also |
| 22 | +- pass a flag for add all the file to the stage: `-a` |
| 23 | +- specify a custom configuration file adding the file path as argument |
| 24 | + |
| 25 | +You can ask for more information using: `$ php vendor/bin/php-commitizen commit --help` |
| 26 | + |
| 27 | +# Configuration file |
| 28 | + |
| 29 | +The configuration file must return an array (or partial override) |
| 30 | + |
| 31 | +``` |
| 32 | +<?php |
| 33 | +
|
| 34 | +return [ |
| 35 | + 'type' => [ |
| 36 | + 'lengthMin' => 1, // Min length of the type |
| 37 | + 'lengthMax' => 5, // Max length of the type |
| 38 | + 'acceptExtra' => false, // Allow adding types not listed in 'values' key |
| 39 | + 'values' => ['feat', 'fix'], // All the values usable as type |
| 40 | + ], |
| 41 | + 'scope' => [ |
| 42 | + 'lengthMin' => 0, // Min length of the scope |
| 43 | + 'lengthMax' => 10, // Max length of the scope |
| 44 | + 'acceptExtra' => true, // Allow adding scopes not listed in 'values' key |
| 45 | + 'values' => [], // All the values usable as scope |
| 46 | + ], |
| 47 | + 'description' => [ |
| 48 | + 'lengthMin' => 1, // Min length of the description |
| 49 | + 'lengthMax' => 44, // Max length of the description |
| 50 | + ], |
| 51 | + 'subject' => [ |
| 52 | + 'lengthMin' => 1, // Min length of the subject |
| 53 | + 'lengthMax' => 50, // Max length of the subject |
| 54 | + ], |
| 55 | + 'body' => [ |
| 56 | + 'wrap' => 72, // Wrap the body at 72 characters |
| 57 | + ], |
| 58 | + 'footer' => [ |
| 59 | + 'wrap' => 72, Wrap the footer at 72 characters |
| 60 | + ], |
| 61 | +]; |
| 62 | +``` |
0 commit comments