Download the PHP package redberryproducts/laravel-version without Composer
On this page you can find all versions of the php package redberryproducts/laravel-version. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download redberryproducts/laravel-version
More information about redberryproducts/laravel-version
Files in redberryproducts/laravel-version
Package laravel-version
Short Description This is my package laravel-version
License MIT
Homepage https://github.com/redberryproducts/laravel-version
Informations about the package laravel-version
Laravel Version Badge Package
This Laravel package generates dynamic version badges that reflect the current application version or Composer version based on various conditions. The badges can be easily displayed in your application and updated automatically based on your environment.
Features
- Display the application version from the
.envfile. - Display the Composer version from
composer.json. - Generate dynamic SVG badges to show the versions.
- Customizable routes for accessing version and badge data.
Installation
Install the package via Composer:
Publish Configuration
After installation, publish the configuration file:
This will create a config/version.php file where you can set your application version:This will create a config/version.php file where you can set your application version:
Usage
Routes
This package provides two routes for fetching version information and generating badges.
- Application Version: Retrieves the current version of your application.
- URL:
/application/version - Controller:
VersionController@index - Returns both the environment version (from .env) and the composer version (from composer.json).
- URL:
- Version Badge: Generates an SVG badge with dynamic content based on the requested provider (either composer or env).
- URL:
/application/version/badge?provider={composer|env}&environment={optional} - Controller:
VersionBadgeController
- URL:
Example Badge
You can include the badge in your application as an SVG by embedding the URL in your frontend or views:
Blade Views
The package also comes with two Blade files for rendering the version and badges.
-
app.blade.php: Displays both the environment and composer versions using the badge component. badge.blade.php: Generates the SVG for the badge based on the label and version provided.
Configuration
The package uses the following environment variable in your .env file:
By default, if APP_VERSION is not set, it will display N/A.
Customization
To customize the badge, you can replace 'badge_blade' => 'version::badge', in the config/version.php file with your
custom blade file.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request or open an issue.
- Fork the repository.
- Create a feature branch:
git checkout -b feature-branch. - Commit your changes:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature-branch. - Open a pull request.
Credits
- Nika Jorjoliani
- All Contributors
All versions of laravel-version with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0