nystudio107/changelog

There is no license information available for the latest version (0.13.0) of this package.

A http://keepachangelog.com/ parser for the common developer

Maintainers

👁 khalwat

Package info

github.com/nystudio107/changelog

pkg:composer/nystudio107/changelog

Fund package maintenance!

khalwat

Statistics

Installs: 37

Dependents: 0

Suggesters: 0

Stars: 0

0.13.0 2020-07-03 19:23 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

Unknown License 6b5dd5f3849af8ddebfccfbf439478a81757f551

  • Bram Devries <bram.woop@madewithlove.be>

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"
 ]
}