2017 © Pedro Peláez
 

library php-gitver

image

sydnerdrage/php-gitver

  • Saturday, November 9, 2013
  • by sydnerdrage
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

gitver

Simple class to parse version tags from a git working directory., (*1)

Build Status Coverage Status, (*2)

Usage

Gitver defaults to the current working directory. As such it requires no immediate configuration, (*3)

use \Gitver\Git;

$gitver = new Git(__DIR__);
echo $gitver->version();

This will output a git describe of the current working directory. e.g. v0.1.1-0-abcdefg, (*4)

This is a combination of: - Most recent tag (matching a $prefixX.Y.Z format - see configuration below) - Number of commits since that tag - Current commit prefixed with 'g' (identifying the repository as git)., (*5)

Configuration

  • Working directory to retrieve version from (defaults to the current working directory)
  • Tag match prefix (defaults to "v")

For example if you version tags are in the format of release-X.Y.Z then you would call, (*6)

$gitver = new Git(__DIR__, "version-");

CakePHP Sample

<?php
use \Gitver\Git;

App::uses('Controller', 'Controller');

class AppController extends Controller
{
    public function beforeFilter()
    {
        parent::beforeFilter();
        $this->set("VERSION", (new Git(__DIR__))->version());
    }
}

The Versions

07/10 2013

v0.0.1

0.0.1.0

  Sources   Download

The Development Requires