PHPackages                             fperezco/captainhook-conventional-branchs-commits - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. fperezco/captainhook-conventional-branchs-commits

ActiveCaptain-hook[Testing &amp; Quality](/categories/testing)

fperezco/captainhook-conventional-branchs-commits
=================================================

Captain hook conventional branchs and commits is just a 'hook' to check that a commit, in a conventional branching model, follows the conventional rules.

v1.1.0(1y ago)268↓93.8%MITPHPPHP &gt;=7.4

Since Feb 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fperezco/captainhook-conventional-branchs-commits)[ Packagist](https://packagist.org/packages/fperezco/captainhook-conventional-branchs-commits)[ RSS](/packages/fperezco-captainhook-conventional-branchs-commits/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Captain Hook PHP conventional commits on conventional branch checker
====================================================================

[](#captain-hook-php-conventional-commits-on-conventional-branch-checker)

Captain hook conventional branch commits is just a 'hook' to check that a commit, in a conventional branching model, follows the conventional rules.

Usage
-----

[](#usage)

The conventional branch and commit checker script will be executed on every commit.

By default, the branch should follow the conventional branches rules:

And, by default, the commits the conventional commits rules:

If the branch or commit message does not follow the rules, the commit will be rejected.

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

[](#installation)

Previously you have should installed captainhook in your project. See:

Install this package using:

```
composer require --dev fperezco/captainhook-conventional-branchs-commits
```

After that, you should configure the commit-msg hook by doing:

```
vendor/bin/captainhook-conventional-branchs-commits configure
```

That command will install the selected config in the commit-msg hook in captainhook.json. By default( option 1), empty configuration so only check for standard conventional commits and branches will be installed.

Configuration
-------------

[](#configuration)

The available variables in the commit-msg hook section for this validator are:

```
"branchPattern": "/^(develop|master|main|(feature|bugfix|hotfix|chore|release)\\/\\w+(-.*)?)$/",
"commitPattern": "/^(customcommit|patterncommit): [A-Za-z0-9-]+$/",

"branchShouldIncludeTicketCode": true,
"branchTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

"commitShouldIncludeTicketCode": true,
"commitTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

"commitAndBranchShouldIncludeTheSameTicketCode": true,
"commitAndBranchCommonTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",
"commitAndBranchCommonTicketCodePatternBranchExceptionsPattern": "/^(develop|master|main)$/"

```

The main variables are those to define the branchPattern and commitPattern.

The pattern that the branch should follow. If no provided, the default is the conventional branches pattern:

```
"branchPattern": '/^(develop|master|main|(feature|bugfix|hotfix|chore|release)\/[A-Za-z0-9-]+)$/'

```

The pattern that the commit should follow. If no provided, the default is the conventional commits pattern (in this case skipping Merge commits):

```
commitPattern: /^(Merge.*|(feat|fix|build|chore|ci|docs|style|refactor|perf|test)(\([A-Za-z0-9-]+\))?: .+)/'

```

If your project requires to provide a specific ticket code always you can set this section, by default/not defined the check is disabled:

```
"branchShouldIncludeTicketCode": true,
"branchTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

```

If your project requires to provide a specific ticket code in the commit message, you can set this section, by default/not defined the check is disabled:

```
"commitShouldIncludeTicketCode": true,
"commitTicketCodePattern": "/^([A-Z]+-[0-9]+)$/",

```

If your project requires that the commit and branch should have the same ticket code in the branch name and in the commit message , you can set this section, by default/not defined the check is disabled:

```
"commitAndBranchShouldIncludeTheSameTicketCode": true,
"commitAndBranchCommonTicketCodePattern": "/[A-Z]+-[0-9]+/",
"commitAndBranchCommonTicketCodePatternBranchExceptionsPattern": "/^(develop|master|main)$/"

```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance43

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

509d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38439531?v=4)[pacoperez](/maintainers/pacoperez)[@PacoPerez](https://github.com/PacoPerez)

---

Top Contributors

[![fperezco](https://avatars.githubusercontent.com/u/60961221?v=4)](https://github.com/fperezco "fperezco (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fperezco-captainhook-conventional-branchs-commits/health.svg)

```
[![Health](https://phpackages.com/badges/fperezco-captainhook-conventional-branchs-commits/health.svg)](https://phpackages.com/packages/fperezco-captainhook-conventional-branchs-commits)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M360](/packages/dms-phpunit-arraysubset-asserts)[moxio/captainhook-eslint

Captain Hook Plugin to validate files using ESLint

1251.3k](/packages/moxio-captainhook-eslint)[bitexpert/captainhook-infection

Captain Hook Plugin to run InfectionPHP only against the files of the current changeset

125.2k6](/packages/bitexpert-captainhook-infection)[captainhook/grumphp

GrumPHP-Integration for CaptainHook

113.9k](/packages/captainhook-grumphp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
