GithubHelp home page GithubHelp logo

changelog-parser's Introduction

Changelog parser

Packagist Travis Coveralls github license

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.

Installation

composer require tfarla/changelog-parser

Usage

Given we have the following markdown file:

## 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:

<?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:

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.

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:

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.

If you want to modify the code then please follow these steps:

  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

changelog-parser's People

Contributors

live627 avatar tomodutch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.