2017 © Pedro Peláez
 

library laravel-git-version

A helper to get the current git version of the application

image

okaufmann/laravel-git-version

A helper to get the current git version of the application

  • Tuesday, September 26, 2017
  • by okaufmann
  • Repository
  • 1 Watchers
  • 0 Stars
  • 433 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

Laravel project git version getter

A helper class to get the current git version of the project., (*1)

Expects either a version file to exist in the base_path() of your project containing a version string, or the git binary to be available., (*2)

This is my own for to match my needs Originally initiated by @tremby Consider contribute to his version., (*3)

Laravel version

This package works with both Laravel 4 and 5., (*4)

Installation

Require it in your Laravel project:, (*5)

composer require okaufmann/laravel-git-version

Install the service provider by adding it to your config/app.php file:, (*6)

'providers' => [
    ...
    Tremby\LaravelGitVersion\GitVersionServiceProvider::class,
],

Use

You can get the git version string with, (*7)

\Tremby\LaravelGitVersion\GitVersionHelper::getVersion()

Or you can get your app name and version number such as my-project/1.0 with, (*8)

\Tremby\LaravelGitVersion\GitVersionHelper::getNameAndVersion()

Also, you can get the latest commit hash by calling this method:, (*9)

\Tremby\LaravelGitVersion\GitVersionHelper::getHash(8)

getHash() method gets an integer which is the length of commit hash. If it's null, getHash() returns full width., (*10)

The app's name is taken from Config::get('app.name', 'app'), so you can configure it in your config/app.php file or leave it as the default of app., (*11)

Command

On releasing a new version of you app run the following commands to tag a new version and create a file with the correct version info:, (*12)

git tag v0.0.3
php artisan version:bump

View

A view is provided which just outputs an HTML comment with the return value of getNameAndVersion(). I like to include this in the main layout template of the project., (*13)

The view is available:, (*14)

@include('git-version::version-comment')

Ensure your git tags are pushed to your servers so that the versions are described properly., (*15)

During development and possibly in staging environments allow the version to be determined automatically (this is done via git describe)., (*16)

As part of your production deployment procedure, write a version file (perhaps via a command like git describe --always --tags --dirty >version, since this is the command this package would run otherwise). When this version file exists the package will use its contents rather than executing git, saving some processor and IO time., (*17)

Add /version to your .gitignore file so your working tree stays clean and you don't accidentally commit it., (*18)

Or you commit it and let the application use the version from the file (e.g. you just bump tags), (*19)

The Versions

26/09 2017

dev-master

9999999-dev

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

26/09 2017

1.1.5

1.1.5.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

21/06 2017

1.1.4

1.1.4.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

21/06 2017

1.1.3

1.1.3.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

21/06 2017

1.1.2

1.1.2.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

09/01 2017

1.1.1

1.1.1.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

14/09 2015

1.1

1.1.0.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

19/06 2015

1.0.1

1.0.1.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel

19/06 2015

1.0

1.0.0.0

A helper to get the current git version of the application

  Sources   Download

MIT

The Requires

 

by Bart Nagel