syonix/changelog-viewer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

syonix/changelog-viewer

Composer 安装命令:

composer require syonix/changelog-viewer

包简介

This package offers a nice display for change log files

README 文档

README

Build Status Total Downloads Latest Stable Version SensioLabsInsight

This package offers a nice way to display change logs.

Changelog Viewer Screenshot

Thanks a lot to Grav CMS who let me use their design for the changelog modal. I use Grav myself and already replaced several Wordpress pages with it. Go check it out!

Installation

Using Composer

Call composer require syonix/changelog-viewer.

Manual installation

Download the project files and upload them to your web server. Include the class autoloader /vendor/autoload.php or configure your own autoloader.

Usage

To render a display, just call a factory function like this:

use \Syonix\ChangelogViewer\Factory\ViewerFactory;
ViewerFactory::createMarkdownHtmlViewer(__DIR__ . '/../CHANGELOG.md')->build();

Processors

Processors are the component of the library that reads the changelog file. Currently implemented is the MarkdownProcessor but you could add any of your own, as long as it implements the Processor\Processor Interface.

MarkdownProcessor

The MarkdownProcessor takes the path to a markdown file and returns an ArrayCollection containing instances of Version. The Markdown file must follow this scheme:

# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

This header is optional but follows the Keep A Changelog recommendation.

## [v0.1.0](https://github.com/Syonix/changelog-viewer/releases/tag/v0.1.0) - 2016-01-23
[See full Changelog](https://github.com/Syonix/monolog-viewer/compare/v4.0.1...v4.0.2)

This is the version header. It contains the version string (adhering to Semantic Versioning) and a link where this release can be downloaded.

### New
- Initial release
- Modular concept to support different sources and outputs

Next are the labels New, Changed and Fixed. New is for new features, Changed is for existing features that have been improved and Fixed is for bugs that have been fixed. Under each label you have a list of changes that fall in this label (category).

This format can be overridden by setting a custom regex:

$processor = new MarkdownProcessor($path)
    ->setRegex(array(
            'version' => '/^## \[(v.+)\]\((.+)\) - ([\d-]+)/',
            'changes_url' => '/^\[See full Changelog\]\((.+)\)/',
            'label' => '/^### (.+)/',
            'change' => '/^- (.+)/',
        ));
(new HtmlFormatter($processor))->build();

Formatters

Formatters are used to display the change log. Currently there is only the HtmlFormatter which outputs the change log to HTML, but you could implement anything else.

HtmlFormatter

The HtmlFormatter prints nice HTML. You have several options for that:

(new HtmlFormatter($processor))
    ->title('Changelog')
    ->modal()
    ->frame(true)
    ->styles(true)
    ->scripts(true)
    ->downloadLinks(true)
    ->output();
Method Default Description
title(string) Changelog Change the title of the modal.
modal(bool) false If set to true (or empty) the changelog will be displayed as a modal and hidden by default. User javascript functions openChangelogModal(), closeChangelogModal() and toggleChangelogModal() to manipulate.
Note: The default behavior when not calling this method is false but calling this method without a value will set it to true.
frame(bool) true If set to false, no frame will be printed.
styles(bool) true Print styles with the modal. Set to false if you want to include your own css.
scripts(bool) true if modal(true)
false otherwise
Print the scripts used to open and close the modal. Set to false if you want to include your own js.
Note: Calling modal(true) also sets scripts to true, so if you want to add your own scripts for the modal, make sure you call scripts(false) after modal().
downloadLinks(bool) false Display a download link for each version. Looks like this:
Download Button
build() Compiles and returns the change log HTML code according to the options above.
output() Calls build() and echoes the HTML code.
Same as echo (new HtmlFormatter($processor))->build();

Localization

If your changelog file is written in another language, you can use the LabelTranslator so the parser recognizes the labels. Refer to the German example for the structure:

{
  "new": "neu",
  "improved": "verbessert",
  "fixed": "behoben",
  "See full Changelog": "Vollständigen Changelog anzeigen"
}

Demo

After cloning or downloading the project, you can quickly launch a demo by running php -S localhost:8081 within the demo directory. Then just open your browser and visit localhost:8081.

syonix/changelog-viewer 适用场景与选型建议

syonix/changelog-viewer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.73k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2016 年 01 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 syonix/changelog-viewer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 syonix/changelog-viewer 我们能提供哪些服务?
定制开发 / 二次开发

基于 syonix/changelog-viewer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 25
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-23