websafe / lib-view-helper-git-repository
A library of ZF2 View Helpers for retrieving information about current application's local Git repository.
0.1.0
2014-03-05 23:23 UTC
Requires
- php: >=5.3.3
- zendframework/zend-view: 2.2.*
Requires (Dev)
- fabpot/php-cs-fixer: dev-master
This package is not auto-updated.
Last update: 2024-12-21 16:46:26 UTC
README
A library of ZF2 - View Helpers for retrieving information about current application's local Git repository.
Quickstart
Add this package to your Composer based application
Add this package to composer.json
and install in vendor/
by running:
composer require \
websafe/lib-view-helper-git-repository:0.1.*
or
php vendor/bin/composer.phar require \
websafe/lib-view-helper-git-repository:0.1.*
Enable provided view helpers in your ZF2 application
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
.
The copied file declares the required invokables for the provided view helpers in your ZF2 application.
return array( 'view_helpers' => array( 'invokables' => array( 'gitRepoCurrentBranch' => 'Websafe\View\Helper\Git\Repository\CurrentBranch', 'gitRepoDescription' => 'Websafe\View\Helper\Git\Repository\Description', ), ), );
Use provided view helpers in your view scripts
Websafe\View\Helper\Git\Repository\CurrentBranch
<h1><?php echo $this->gitRepoCurrentBranch();?></h1>
Result:
<h1>master</h1>
Websafe\View\Helper\Git\Repository\Description
<p><?php echo $this->gitRepoDescription();?><p>
Result:
<p>Unnamed repository; edit this file 'description' to name the repository.</p>