kba-team / cake2_app_version
CakePHP plugin to determine the current version of your application. The version is either taken from the commit.json of the deploy script or from the local clone of the git repository.
Package info
github.com/the-kbA-team/cake2_app_version
Language:Makefile
Type:cakephp-plugin
pkg:composer/kba-team/cake2_app_version
Requires
- php: >8.0, <8.4
- composer/installers: ^1.12 || ^2.2
- kba-team/cakephp: ^2.11.1
- kba-team/version: ^2.0
Requires (Dev)
- phpstan/phpstan: ^2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
CakePHP 2.x plugin to determine the current version of your application. The version is either taken from the commit.json of the deploy script or from the local clone of the git repository.
Usage
<?php echo constant('APP_VERSION'); // Separate identifiers, e.g. for structured logging: echo APP_VERSION_IDENTIFIER; echo APP_COMMIT;
APP_VERSION_IDENTIFIER is the release tag or Git ref recorded in
commit.json, or the local Git branch when the file is unavailable.
APP_COMMIT is the abbreviated commit SHA as provided by the source. When
neither source provides both values, each constant contains ~ ? ~.
APP_VERSION retains the combined identifier (rev. commit) format and its
existing fallback. The plugin reads APP/webroot/commit.json; custom file
paths are no longer supported.
The constants are set once at bootstrap. Restart long-running workers after a deployment to pick up the new values. Applications can add the separate constants to their own logging configuration; this plugin does not configure Graylog.
Installation
Composer Installers 1.12 and 2.2 or newer compatible releases are supported.
- Require the plugin.
composer require kba-team/cake2_app_version
- Include the plugin in your
bootstrap.php
<?php CakePlugin::load('AppVersion', ['bootstrap' => true, 'routes' => false]);
Development
The Makefile runs Composer and PHP tools in Docker. Supported PHP versions are 8.1, 8.2, and 8.3.
make install PHP_VERSION=8.1
make lint PHP_VERSION=8.1
make test PHP_VERSION=8.1
make analyze PHP_VERSION=8.1
make audit PHP_VERSION=8.1
make validate
Use DEPENDENCIES_LOWEST=1 with make install to resolve the lowest allowed
dependency versions.
Distribution archives contain the plugin bootstrap, Composer metadata, and license. Composer source installations use a full repository checkout instead.
Agent instructions and engineering-skill configuration are in AGENTS.md.
Pull requests and CI
Create an issue and branch from main in this repository using the name
issue/<number>-<description>. Open a pull request against main. Force-pushes
are allowed only on issue/* branches; forks have their own settings.
CI runs automatically for pull requests to main and can also be started
manually. New commits cancel any older, still-running CI for the same pull
request. Branch pushes, merges to main, tags and releases do not trigger CI.
All five CI jobs must pass, and the pull request branch must be up to date with
main before merging. Update an out-of-date branch and wait for CI to pass
again. No review approval is required. Only squash merges are allowed; GitHub
deletes the issue branch after merging.