vdhicts/keepachangelog-parser
Composer 安装命令:
composer require vdhicts/keepachangelog-parser
包简介
Parser for the Keep A Changelog standard
关键字:
README 文档
README
Parser for the Keep A Changelog standard.
Requirements
This package requires at least PHP 8.2 or newer.
Installation
You can install the package via composer:
composer require vdhicts/keepachangelog-parser
Usage
This package is intended to be easy to use.
Parsing the changelog
$content = file_get_contents('CHANGELOG.md'); $parser = new \Vdhicts\KeepAChangelog\Parser(); $changelog = $parser->parse($content);
Using a different date format
The parser will parse the releases with the Y-m-d format by default.
If you would like to use another format, you can just pass the format to the setDateFormat function.
$content = file_get_contents('CHANGELOG.md'); $parser = new \Vdhicts\KeepAChangelog\Parser(); $changelog = $parser ->setDateFormat('Y-m-d H:i:s') ->parse($content);
Accessing the changelog
The parser will return a Changelog models, with contains a collection of Release models. The Release model
contains a collection of Section models.
The changelog has several methods the retrieve information:
// Get the description of the changelog, which returns an array of lines $descriptionHtml = implode('<br>', $changelog->getDescription()); // Determine if the changelog has any releases $changelog->hasReleases(); // Get the unreleased section $unreleased = $changelog->getUnreleased(); // Get the latest release $latestRelease = $changelog->getLatestRelease();
When all releases are retrieved, the newest will be the first and the unreleased will be the last one when present.
The release has several methods to get information about the release:
// Determine if the current one is the unreleased section $isUnreleased = $release->isUnreleased(); // Get the version for the release $version = $release->getVersion(); // Get the release date, will be null when not released or a date isn't provided $data = $release->getReleasedAt(); // Get the tag reference, usually something like https://github.com/vdhicts/keepachangelog-parser/compare/v0.0.1...v1.0.0 $tagReference = $release->getTagReference(); // Get a specific section of the release $added = $release->getSection(Section::ADDED); // Get the collection of sections for the release $sections = $release->getSections();
The section consists of a type (like Added, etc.) and an array of entries:
$type = $section->getType(); $entries = $section->getEntries(); $entriesHtml = implode('<br>', $entries);
Tests
Unit tests are available in the tests folder. Run with:
composer test
When you want a code coverage report which will be generated in the build/report folder. Run with:
composer test-coverage
Contribution
Any contribution is welcome, but it should meet the PSR-12 standard and please create one pull request per feature/bug. In exchange, you will be credited as contributor on this page.
Security
If you discover any security related issues in this or other packages of Vdhicts, please email security@vdhicts.nl instead of using the issue tracker.
Support
If you encounter a problem with this parser or has a question about it, feel free to open an issue on GitHub.
License
This package is open-sourced software licensed under the MIT license.
vdhicts/keepachangelog-parser 适用场景与选型建议
vdhicts/keepachangelog-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.78k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「parser」 「changelog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vdhicts/keepachangelog-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vdhicts/keepachangelog-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vdhicts/keepachangelog-parser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
An MT940 bank statement parser for PHP
A Deployment/Change Log Schedule and Notes system for SilverStripe sites
Package to enable change logs to be parsed
A Filament plugin that displays a beautiful version changelog modal with an always-accessible 'What's New' button.
Laravel integration for the jsonapi.org parser
统计信息
- 总下载量: 12.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-15