2017 © Pedro Peláez
 

library changelog-parser

Extract release information from the changelog

image

tfarla/changelog-parser

Extract release information from the changelog

  • Saturday, May 19, 2018
  • by TFarla
  • Repository
  • 1 Watchers
  • 0 Stars
  • 48 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 41 % Grown

The README.md

Changelog parser

Packagist Travis Coveralls github license, (*1)

Requirements

Why

A changelog contains information about all the changes in a project. This parsers can be used to extract information about a specific release. That information may then be distributed towards your friends, clients, colleagues and other parties., (*2)

Installation

composer require tfarla/changelog-parser

Usage

Given we have the following markdown file:, (*3)

## 1.0.0 - 2018-12-20
### Added
- A cool new feature

### Changed
- that thing that was too complex
- slow code into fast code

### Removed
- A gastly bug

When we parse that markdown file using the MarkdownParser:, (*4)

<?php

use \TFarla\ChangelogParser\MarkdownParser;

$parser = new MarkdownParser();

$result = $parser->parse(file_get_contents('CHANGELOG.md'));

foreach ($result->getReleases() as $release) {
    echo $release->getVersion() . PHP_EOL;
    echo $release->getDate()->format('Y-m-d') . PHP_EOL;
    foreach ($release->getChanges() as $type => $changes) {
        echo $type . PHP_EOL;
        foreach ($changes as $change) {
            echo "- $change" . PHP_EOL;
        }
    }
}

Then we will receive the following output:, (*5)

1.0.0
2018-12-20
Added
- A cool new feature
Changed
- that thing that was too complex
- slow code into fast code
Removed
- A gastly bug

Tested changelog formats can be found under the tests/fixtures directory., (*6)

Running tests

This project uses golden files to assert expected behaviour. These golden files should be part stored in the git repository and can be generated by setting the GOLDEN environment variable to 1:, (*7)

GOLDEN=1 composer test

Contributing

Thanks for reading this far into the README and considering contributing to this project. If you have any questions or suggestions feel free to create an issue., (*8)

If you want to modify the code then please follow these steps:, (*9)

  1. Fork it (https://github.com/TFarla/changelog-parser)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

The Versions

19/05 2018

dev-master

9999999-dev

Extract release information from the changelog

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Farla

19/05 2018