paysera/lib-changelog-parser
Composer 安装命令:
composer require paysera/lib-changelog-parser
包简介
Parses changelog.md formatted by keepachangelog.com to PHP structure and dumps back
README 文档
README
lib-changelog-parser 
Parses and dumps CHANGELOG.md file written according to https://keepachangelog.com/en/1.0.0/ specifications for programmatic manipulation.
Parsing:
Suppose you have a changelog:
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## 1.0.1 ### Added - `php-generator:symfony-bundle` added to `phar` ## 1.0.0 ### Added - support of something. - another feature added. ### Removed - In particular class some method was removed. ### Changed - Changed how things are parsed in parser.
You can now parse it:
$parser = new ChangelogParser(new ValueExtractor(new ChangelogConfiguration())); $changelog = $parser->parse(file_get_contents($pathToChangelog)); print_r($changelog);
Internal structure of parsed result:
Changelog Object
[header:Changelog:private] => # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
[versions] => Array
[0] => VersionInfo Object
[version] => 1.0.1
[date] =>
[changeEntries] => Array
[0] => ChangeEntry Object
[changeType] => Added
[changeDetails] => Array
[0] => ChangeDetails Object
[description] => `php-generator:symfony-bundle` added to `phar`
[1] => VersionInfo Object
[version] => 1.0.0
[date] =>
[changeEntries] => Array
[0] => ChangeEntry Object
[changeType] => Added
[changeDetails] => Array
[0] => ChangeDetails Object
[description] => support of something.
[1] => ChangeDetails Object
[description] => another feature added.
[1] => ChangeEntry Object
[changeType] => Removed
[changeDetails] => Array
[0] => ChangeDetails Object
[description] => In particular class some method was removed.
[2] => ChangeEntry Object
[changeType] => Changed
[changeDetails] => Array
[0] => ChangeDetails Object
[description] => Changed how things are parsed in parser.
Dumping
You can dump Changelog object back to markdown using ChangelogDumper and twig template:
$dumper = new ChangelogDumper( new ChangelogConfiguration(), new Twig_Environment( new Twig_Loader_Array([ 'changelog.md' => file_get_contents(__DIR__ . '/../src/Template/changelog.md.twig'), ]) ), 'changelog.md' ); $contents = $dumper->dump($changelog); print_r($contents)
You should get formatted markdown contents according to ChangelogConfiguration:
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## 1.0.1 ### Added - `php-generator:symfony-bundle` added to `phar` ## 1.0.0 ### Added - support of something. - another feature added. ### Removed - In particular class some method was removed. ### Changed - Changed how things are parsed in parser.
paysera/lib-changelog-parser 适用场景与选型建议
paysera/lib-changelog-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.63k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 08 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 paysera/lib-changelog-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 paysera/lib-changelog-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-03