Looking to hire Laravel developers? Try LaraJobs

laravel-version-bumper maintained by myopensoft

Description
Bump your app's semantic version from Conventional Commits and generate a Keep-a-Changelog entry.
Last update
2026/06/15 07:29 (dev-main)
License
Downloads
0

Comments
comments powered by Disqus

Laravel Version Bumper

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 plain VERSION file (version_file).
  • config_file — regex-patch a literal in any file, e.g. 'version' in config/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.