gianarb/corley-version

This package is abandoned and no longer maintained. The author suggests using the gianarb/corley-version package instead.

Manage version and bump in your ZF2 application

0.0.3 2014-11-08 11:56 UTC

This package is not auto-updated.

Last update: 2021-03-15 09:15:56 UTC


README

Manage version bump in your Zend Framework Application

  • Master Travis-CI: Build Status

Console Command

php index.php version-show

Return current version

php index.php version-bump 0.0.1

Bump version 0.0.1

  • Write or edit VERSION file
  • Add version node in your global.php configuration file

View Helper

You can use $this->version() to append the version number in your static resources

<html>
    ...    
    <?php echo $this->headScript()
        ->prependFile($this->basePath("/js/script.js?v={$this->vesion()}"))
        ->prependFile($this->basePath('/js/bootstrap.min.js'))
        ->prependFile($this->basePath('/js/jquery.min.js'))
    ; ?>
    ...
</html>

Configuration

<?php
return array(
    'corley-version' => array(
        'version-file-path' => ".",
        'config-path' => "./config/autoload/global.php",
    )
);

version-file-path is path of VERSION file

Write 'version' node into config-path

Event Driven

version-bump <version> trigger version.bump event. This module attach only one listener

/** @var \Zend\EventManager\EventManager $em */
$em->getSharedManager()->attach('version' ,'version.bump', function($e){
    $e->getTarget()->bump($e->getParams()['version']);
}, 100);