myopensoft/laravel-version-bumper
Composer 安装命令:
composer require myopensoft/laravel-version-bumper
包简介
Bump your app's semantic version from Conventional Commits and generate a Keep-a-Changelog entry.
README 文档
README
Bump your Laravel app's semantic version from Conventional Commits and generate a Keep a Changelog entry — from the commits since your last git tag.
Installation
composer require myopensoft/laravel-version-bumper --dev
Publish the config (optional):
php artisan vendor:publish --tag=laravel-version-bumper-config
Usage
# Preview only — nothing is written
php artisan version:bump --dry-run
# Write the new version + changelog (no git actions)
php artisan version:bump
# Write, then commit / tag / push (each is opt-in)
php artisan version:bump --commit --tag --push
The bump level follows Conventional Commits: feat → minor, fix/perf → patch, and any
commit marked breaking (feat!: or a BREAKING CHANGE: footer) → major. The baseline is your
most recent git tag; if no commit since that tag warrants a release, the command exits quietly.
Worked example
Given a repo tagged 1.2.0 with these commits since the tag:
feat(billing): add invoice export
fix(api): correct pagination offset
docs: tweak readme
feat outranks fix, so the next version is a minor bump — and docs is ignored:
$ php artisan version:bump --dry-run
INFO Bumping 1.2.0 → 1.3.0 (Minor).
## [1.3.0] — 2026-06-14
### Added
- billing: add invoice export
### Fixed
- api: correct pagination offset
WARN Dry run — nothing written, committed, or pushed.
Dropping --dry-run writes VERSION and prepends the entry to CHANGELOG.md. Adding
--commit --tag then creates the release commit and tag:
$ php artisan version:bump --commit --tag
INFO Bumping 1.2.0 → 1.3.0 (Minor).
...
INFO Released 1.3.0.
$ git log --oneline -1 && git tag --list '1.3.0'
0943494 chore(release): 1.3.0
1.3.0
Configuration
config/version-bumper.php lets you choose where the version lives (source):
file(default) — a plainVERSIONfile (version_file).config_file— regex-patch a literal in any file, e.g.'version'inconfig/app.php.git_tag— read from the latest tag; the release tag is the source of truth (no file written).
You can also customise the changelog path, date format, the commit-type → changelog-section map
(sections), the commit-type → bump-level map (bumps), and the git remote/branch.
Which commits trigger a release
By default only feat, fix, and perf commits (plus any breaking change) trigger a release;
everything else (docs, chore, test, refactor, style, …) is ignored. Add an entry to the
bumps map if you want another type to trigger a bump, and to sections if you want it to appear
in the changelog.
Git actions are opt-in
A plain php artisan version:bump only writes the version and changelog. Committing, tagging, and
pushing each require their own flag (--commit, --tag, --push), so the package never touches
your git remote unless you ask it to.
Testing & static analysis
composer test # Pest
composer analyse # PHPStan level 10
composer psalm # Psalm errorLevel 1
composer format # Pint
License
The MIT License (MIT). Please see the License File for more information.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-15