Download the PHP package woweb/laravel-version-endpoint without Composer

On this page you can find all versions of the php package woweb/laravel-version-endpoint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-version-endpoint

Laravel version endpoint

A signed, read-only /__version endpoint that reports what a Laravel application is actually running: the PHP version, the framework version, the deployed git tag and commit, the hash of the deployed composer.lock, and the versions of the runtimes around it.

It exists for inventory tooling. Something has to answer the question "which version of this application is live, and is anything underneath it out of support" without a person logging in to look. This package answers that question over HTTP, to one caller, and to nobody else.

How it is protected

The caller signs a short message with an ed25519 private key and sends it in two headers. The application verifies that signature with the matching public key.

That direction matters. The public key sits in the application's environment and is not a secret, so an application that is compromised leaks nothing that lets anyone impersonate the caller or read any other application. The signed message is the request timestamp plus the request path, so a captured request cannot be replayed once its timestamp falls outside the tolerance window, and it cannot be pointed at a different path.

Every failure, including a missing key, answers 404. Without a valid signature the endpoint is indistinguishable from a path that does not exist.

Requirements

PHP 8.2 or newer with ext-sodium, and Laravel 12 or 13.

Installation

The service provider is auto-discovered and registers the route. Publish the config only if you want to change something:

1. Generate a keypair

On the machine that will do the probing:

Keep the private key on the caller. One keypair can serve every application, or you can issue one per application; the package does not care which you choose.

2. Configure the application

Optional:

REGISTER_VERSION_FILE is resolved against the application base path when it is relative, and used as given when it is absolute. Keep it outside public/.

3. Write the deploy facts on every deploy

The command records the tag, commit, branch, Node.js version and deploy timestamp in the version file. The sha, branch and Node.js version are read from the checkout when they are not passed. The endpoint reads that file instead of shelling out to git per request, so a web request never starts a subprocess.

There is no fallback. If a deploy does not run this command, the endpoint reports null for the git fields, which is honest: nothing knows what was deployed.

The command also answers to register:build-version, so an application that already had a command by that name can adopt the package without touching its deploy pipeline in the same release.

4. Sign the request on the caller

The path in the signed message is the path the application sees. A proxy that rewrites the path breaks verification, which shows up as an unexplained 404 after a deploy.

The response

Field Meaning
php The PHP version serving the request.
framework The Laravel version the application booted.
git_tag The release tag recorded at deploy time, or null.
git_sha The commit recorded at deploy time, or null.
composer_lock_hash sha256: plus the hash of the deployed composer.lock, so a caller can compare it with the one committed in the repository.
app_env The application environment.
branch The branch recorded at deploy time. A deploy pinned to a tag is detached and reports null.
runtimes A map of runtime versions, keyed by their endoflife.date slug. Anything not detected is left out.
deployed_at When the deploy wrote the version file, or null.
checked_at When this response was built.

runtimes can carry:

Valkey reports a redis_version as well, but that is a protocol compatibility number: reporting it as Redis would produce a wrong end of life verdict, so the Valkey version wins and decides the slug.

Every runtime lookup runs only after the signature has been verified, reads no application data, and is wrapped on its own. An engine that is down, absent or not configured drops out of the payload rather than failing the response: a 500 would hide the whole version picture behind a single outage. Switch individual lookups off in the config if you would rather not have them at all.

The contract

The response shape is the point of this package, so it is versioned with the package itself.

Consumers should read the package version from the application's composer.lock to know which contract they are talking to.

What it deliberately does not do

Configuration reference

Everything lives in config/version-endpoint.php:

Key Default Purpose
enabled true Register the route at all.
path __version Where the endpoint lives. Part of the signed message.
route_name version-endpoint The route name, for route() and tests.
throttle 10,1 Laravel's max,minutes form, applied before verification. null leaves rate limiting to whatever sits in front.
middleware [] Extra middleware, applied after verification.
verify_key null The base64 ed25519 public key. Without it the endpoint answers 404.
clock_skew 60 Seconds of tolerance on the request timestamp.
timestamp_header X-Register-Timestamp
signature_header X-Register-Signature
version_file storage/app/private/version.json Where the deploy facts are written and read.
file_permissions null Octal mode to set on the version file after writing it, for example 0640. null leaves it to the umask, which is safer by default: a mode that excludes the web server user would leave the endpoint unable to read its own facts.
runtimes all enabled Switch the os, database and cache lookups on or off.
os_release_path /etc/os-release Where the distribution id and version are read.

The route is registered outside any middleware group, so it carries no session or cookie handling.

Development

License

MIT. See LICENSE.md.


All versions of laravel-version-endpoint with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-sodium Version *
illuminate/console Version ^12.0 || ^13.0
illuminate/contracts Version ^12.0 || ^13.0
illuminate/filesystem Version ^12.0 || ^13.0
illuminate/http Version ^12.0 || ^13.0
illuminate/process Version ^12.0 || ^13.0
illuminate/routing Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package woweb/laravel-version-endpoint contains the following files

Loading the files please wait ...