sebastian/version
Library for managing the version numbers of Git-hosted PHP projects. Pass a release version and source path, then call asString() to get values like 1.0.0-17-g00f3408 from git describe, or plain X.Y.Z and X.Y-dev outside Git repositories.
git describe --tags is a one-liner — it's the tag-precedence rules. The 7.0.1 patch fixes a defect where a tag from an older release series wins after a maintenance branch is merged forward. That's the exact bug we would write ourselves and only discover when a health endpoint reports 6.0.9 on a 7.x build. Buying a maintained edge-case fixer is cheaper than owning that logic.php artisan app:version, /internal/version health checks, Sentry/APM release tags, cache-busting keys). It should never sit on a customer request path, which is what makes the risk profile acceptable.7.x on main, 6.x maintenance, merged back), cherry-pick-heavy hotfix flows, deployment verification ("is the box running the commit I think it is?"), and log-to-deploy correlation during incident review. If we don't have a second live release series, this is over-engineering.composer require latest.composer.json and the actual tag list ourselves before we standardize.Adopt when:
new Version('X.Y.Z', __DIR__) → asString()) over a hand-rolled tag parser.^7.0.1 or later on the matching PHP line, and your CI does a full or deepened clone (git fetch --depth=10 --tags) — shallow clones make git describe fail silently and you'll ship -dev versions without noticing.Look elsewhere when:
git describe --tags step writing a generated file (or config/version.php) is zero dependencies and zero PHP-line coupling. This is our fallback and it should be built regardless — it's the pilot's exit criterion.main, one release line, no maintenance branches — the tag-precedence fix buys you nothing.To executives: "A small, build-time-only dependency that turns our Git tags into a trustworthy version string. The current patch fixes a specific bug we'd likely have hit ourselves — after merging a maintenance branch into main, older releases reported the maintenance version instead of the current one. Someone is running this in exactly our branching model and fixed it, which is the maintenance signal we want. Blast radius is contained: it runs in the pipeline and internal tooling, never in customer-facing request paths, so a bad release breaks a build rather than production. Cost of adoption is a Composer line and a pinned major."
To engineering: "Pilot ^7.0.1 on the release branches for one cycle, behind a config/version.php value that CI populates from CI_COMMIT_TAG. Guardrails: full clone with tags fetched in CI, assert the reported major matches the branch's series, and warn loudly if -dev shows up in a production build. We build the git describe fallback in parallel — if the tool doesn't earn its keep in one cycle, we drop it with no rework."
Framing correction to carry into the room: an earlier review of this package was based on unverified metadata — an unsupported-constraint claim and a release date that don't reconcile with the published line. We're re-baselining on the actual manifest and tag history before final sign-off, and I'd rather flag that now than have it surface after we've standardized.
How can I help you explore Laravel packages today?