bramdevries / changelog
A http://keepachangelog.com/ parser for the common developer
Installs: 10 400
Dependents: 2
Suggesters: 0
Security: 0
Stars: 20
Watchers: 3
Forks: 3
Open Issues: 2
pkg:composer/bramdevries/changelog
Requires
- php: >=7.4
- league/commonmark: ^1.0
- symfony/css-selector: ~5
- symfony/dom-crawler: ~5
Requires (Dev)
- phpspec/phpspec: ~6
This package is auto-updated.
Last update: 2025-10-29 01:45:14 UTC
README
Parse changelogs like a pro
This package makes it easy to parse change logs in the keepachangelog.com format
Installation
composer require bramdevries/changelog
Usage
Parsing an entire change log
The following change log:
# Change Log A change log for the change log parser ## 0.2.0 - 2014-11-22 ### Added * `getChanges` method to retrieve a single release ## 0.1.0 - 2014-11-22 ### Added * `getReleases` method that retrieves the releases described in a change log * `toJson` method that creates a json representation of a change log.
$parser = new Changelog\Parser(file_get_contents('CHANGELOG.md'); echo $parser->toJson();
Will return
{
  "description": "A change log for the change log parser",
  "releases": [
    {
      "name": "0.0.1",
      "date": "2014-11-22",
      "changes": {
        "added": [
          "<code>getReleases</code> method that retrieves the releases described in a change log",
          "<code>toJson</code> method that creates a json representation of a change log."
        ]
      }
    }
  ]
}
Parsing a single release's changelog
eg: If you want to parse a pull request in this format
### Added - Addition 1 - Addition 2 ### Changed - Change 1 - Change 2 ### Removed - Removal 1 - Removal 2
// Assuming $content contains the above markdown $parser = new Changelog\Parser($content); echo $parser->getChanges();
returns
{
  "added": [
    "Addition 1",
    "Addition 2"
  ],
  "changed": [
    "Change 1",
    "Change 2"
  ],
  "removed": [
    "Removal 1",
    "Removal 2"
  ]
}