Download the PHP package choerulumam/commitlint-php without Composer
On this page you can find all versions of the php package choerulumam/commitlint-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download choerulumam/commitlint-php
More information about choerulumam/commitlint-php
Files in choerulumam/commitlint-php
Package commitlint-php
Short Description A powerful Git hooks and commit message linting tool for PHP projects - PHP 7.3+ compatible
License MIT
Informations about the package commitlint-php
CommitLint PHP ๐ฏ
A powerful Git hooks and commit message linting tool for PHP projects - combining the best of husky and commitlint in a native PHP implementation.
๐ Features
- ๐ฏ Commit Message Validation - Enforce conventional commit format with customizable rules
- ๐ช Git Hooks Management - Easy installation and management of Git hooks
- โ๏ธ Flexible Configuration - Configure via
.commitlintrc.jsonorcomposer.json - ๐ง Developer Friendly - Beautiful CLI output with helpful error messages
- ๐ฆ Minimal Dependencies - Only requires Symfony Console component
- ๐งช Fully Tested - Comprehensive test suite with PHPUnit
- ๐จ PHP 7.3+ Compatible - Works with PHP 7.3 through PHP 8.3
- ๐ Security First - Built-in security features and input validation
Requirements
- PHP >= 7.3
- Composer
- Git
๐ฆ Installation
Install via Composer:
๐ง Quick Start
1. Install Git Hooks
2. Start Making Commits!
๐ Commands
Install Hooks
Install Git hooks and create default configuration:
Options:
--force, -f- Force installation even if hooks already exist--skip-config- Skip creating default configuration file
Validate Commit Message
Validate commit messages against your configuration:
Options:
--file, -f- Read commit message from specific file--quiet, -q- Suppress output (exit code only)
Show Status
Display installed hooks and configuration:
Uninstall
Remove all installed Git hooks:
โ๏ธ Configuration
CommitLint PHP can be configured via .commitlintrc.json file or within your composer.json. The tool automatically merges your custom configuration with sensible defaults.
Configuration File Priority
.commitlintrc.jsonin your project rootextra.commitlint-phpincomposer.json- Default configuration
Complete Configuration Reference
Configuration Options
Type Rules (rules.type)
required(boolean, default:true) - Whether commit type is requiredallowed(array, default: see above) - Array of allowed commit types
Scope Rules (rules.scope)
required(boolean, default:false) - Whether commit scope is requiredallowed(array, default:[]) - Array of allowed scopes (empty = any scope allowed)
Subject Rules (rules.subject)
min_length(int, default:1) - Minimum subject lengthmax_length(int, default:100) - Maximum subject lengthcase(string, default:"any") - Case requirement:"lower","upper", or"any"end_with_period(boolean, default:false) - Whether subject must end with period
Body Rules (rules.body)
max_line_length(int, default:100) - Maximum line length for body (0 = no limit)leading_blank(boolean, default:true) - Require blank line between subject and body
Footer Rules (rules.footer)
leading_blank(boolean, default:true) - Require blank line between body and footer
Hook Configuration (hooks)
Control which Git hooks are installed:
๐ Example Configurations
Minimal Configuration
Strict Configuration
Configuration in composer.json
๐ Commit Message Format
This package enforces the Conventional Commits specification:
Examples
Default Commit Types
feat- New featuresfix- Bug fixesdocs- Documentation changesstyle- Code style changes (formatting, etc)refactor- Code refactoringperf- Performance improvementstest- Adding or updating testschore- Maintenance tasksci- CI/CD changesbuild- Build system changesrevert- Reverting previous commits
Special Commit Types (Auto-Skip Validation)
The following commit types automatically skip validation:
- Merge commits -
Merge branch "feature" into main - Revert commits -
Revert "feat: add user authentication" - Initial commits -
Initial commit - Fixup commits -
fixup! feat: add user authentication
๐ ๏ธ Development
Running Tests
๐ค Contributing
Contributions are welcome! Please read our Contributing Guide for details.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Inspired by husky and commitlint
- Inspired by dev-kraken/php-commitlint
- Built with Symfony Console
Author
chumam2050 - [email protected]