Statistics
19
2
0
60d
Badges
Dependencies

Git Repository Tags

Build Status Total Downloads Latest Stable Version License Monthly Downloads

Package Installation

The best way to install Git Repository Tags is using Composer:

$ composer require galek/git-repository-tags

Basic usage:

$directory = __DIR__ . '/..'; // where we have directory `.git`, not end with `/` or `\`
$versionPrefix = 'v'; // prefix for version, default is v, so v1.0.0
$currentBranchVersion = true; // true|false , return version by HEAD of branch
$gitTags = new \Galek\GitRepositoryTags\GitRepositoryTags($directory, $versionPrefix, $currentBranchVersion);

// gets informations:

$tags = $gitTags->tags; // array of everyone tags
$versions = $gitTags->versions; // array of everyone tags with our version prefix
$latestVersion = $git->tags->latestVersion; // string, get full name of latest version

Nette usage:

config.neon

extensions: 
    gitTags: Galek\GitRepositoryTags\DI\GitRepositoryTagsExtension

gitTags:
	directory: %appDir%/..
	versionPrefix: 'v'
	byCurrentBranch: true

Presenter

class BasePresenter extends Presenter
{
    /** @var \Galek\GitRepositoryTags\GitRepositoryTags @inject */
    public $gitTags;
    
    public function renderDefault()
    {
        $this->template->version = $this->gitTags->latestVersion;
        $this->template->currentVersion = $this->gitTags->currentVersion;
    }
}

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com