Websafe\View\Helper\Git\Repository
A library of ZF2 - View Helpers for retrieving information about current
application's local Git repository., (*1)
Quickstart
Add this package to your Composer based application
Add this package to composer.json
and install in vendor/
by running:, (*2)
~~~~ bash
composer require \
websafe/lib-view-helper-git-repository:0.1.*, (*3)
or
~~~~ bash
php vendor/bin/composer.phar require \
websafe/lib-view-helper-git-repository:0.1.*
To enable the provided view helpers in your application - copy the file
websafe.view.helper.git.repository.global.php.dist
found in
vendor/websafe/lib-view-helper-git-repository/config/
, to
config/autoload/websafe.view.helper.git.repository.global.php
., (*4)
The copied file declares the required invokables for the provided
view helpers in your ZF2 application., (*5)
~~~~ php
return array(
'view_helpers' => array(
'invokables' => array(
'gitRepoCurrentBranch'
=> 'Websafe\View\Helper\Git\Repository\CurrentBranch',
'gitRepoDescription'
=> 'Websafe\View\Helper\Git\Repository\Description',
),
),
);, (*6)
### Use provided view helpers in your view scripts
#### Websafe\View\Helper\Git\Repository\CurrentBranch
~~~~ php
<h1><?php echo $this->gitRepoCurrentBranch();?></h1>
Result:, (*7)
~~~~ html, (*8)
master
#### Websafe\View\Helper\Git\Repository\Description
~~~~ php
<
p>gitRepoDescription();?>
<
p>
Result:, (*9)
~~~~ html
, (*10)
Unnamed repository; edit this file 'description' to name the repository., (*11)
~~~~