Download the PHP package spinen/laravel-version without Composer

On this page you can find all versions of the php package spinen/laravel-version. 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

SPINEN's Laravel Version

Latest Stable Version Latest Unstable Version Total Downloads License

There are many times that it is nice to know the version of your application. At Spinen, we adhere to Semantic Versioning for our applications using git-flow. We keep a file in the root of our projects named VERSION with the current version. The CI/CD process modifies the VERSION file to append meaningful data. Then in the views we display the version like this <meta name="application-version" content="{{ $version }}">. Additionally, we have a smokescreen test to hit a /version route to make sure that the expected version of the site is running.

Build Status

Branch Status Coverage Code Quality
Develop Build Status Code Coverage Scrutinizer Code Quality
Master Build Status Code Coverage Scrutinizer Code Quality

Prerequisite

As side from Laravel >= 8, there are no packages that are required.

Install

Install Version:

The package uses the auto registration feature of Laravel 5.

Description of version file

You need a file, with the Semantic Version of your application. For example...

Then you can add additional data either manually or via your CI/CD pipeline to be similar to this...

Breakdown of the line of the file

Line Content Source Purpose
1 4.3.6 Original content in the VERSION file Split on . to get major, minor, patch
2 "\n" (Optional) New line Readability
3 feature/some_great_thing Name of branch Becomes the pre_release
4 sha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0 Git commit SHA Part of meta
5 build:11425 Build number Part of meta
6 20190220170058+0000 Datetime stamp of build Part of meta

Some notes about the file...

Using the package

The Spinen\Version\Version object loads the configured version file to parse the file into the following public properties on the object...

Property Example
semver 4.3.6-feature/some_great_thing+sha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0.build:11425.20190220170058+0000
version 4.3.6
major 4
minor 3
patch 6
pre_release feature/some_great_thing
meta sha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0.build:11425.20190220170058+0000

You can inject Spinen\Version\Version into your code to gain access to the properties. For our use, here are 3 main uses of the package...

  1. $version variable in views
  2. /version route
  3. version commands

Variable in views

An instance of \Spinen\Version\Version is added to to all views as the $version variable. You can do things like...

Route

Visiting /version will return the version...

Commands

The following artisan commands are added...

Command Description
version Display full version of the application.
version:major Display major version of the application.
version:meta Display meta version of the application.
version:minor Display minor version of the application.
version:patch Display patch version of the application.
version:pre_release Display pre_release version of the application.
version:semver Display semver version of the application.

Configuration

Publish the package config file to config/version.php:

This file is fully documented. You will need to make the changes to that file to suit your needs. There are 3 main configuration items...

  1. file - Name of the file that has the version
  2. route - Configuration of the route to display the version
  3. view - Configuration of the view composer to add the version to the views

Example CI to modify version file

We use GitLab, so here is a partial example job that we have in our .gitlab-ci.yml...


All versions of laravel-version with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/console Version ~8|~9|~10|~11
illuminate/container Version ~8|~9|~10|~11
illuminate/routing Version ~8|~9|~10|~11
illuminate/support Version ~8|~9|~10|~11
illuminate/view Version ~8|~9|~10|~11
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 spinen/laravel-version contains the following files

Loading the files please wait ....