gianarb/corley-version

此包已被 废弃 并不再维护。作者建议使用 gianarb/corley-version 包。

管理 ZF2 应用程序中的版本和升级

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

在您的 Zend Framework 应用程序中管理版本升级

  • 主 Travis-CI: 构建状态

控制台命令

php index.php version-show

返回当前版本

php index.php version-bump 0.0.1

升级版本 0.0.1

  • 编写或编辑 VERSION 文件
  • 在您的 global.php 配置文件中添加版本节点

视图助手

您可以使用 $this->version() 在静态资源中添加版本号

<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>

配置

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

version-file-path 是 VERSION 文件的路径

将 'version' 节点写入 config-path

事件驱动

version-bump <version> 触发 version.bump 事件。此模块仅附加一个 监听器

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