PHPackages                             jwage/changelog-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jwage/changelog-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jwage/changelog-generator
=========================

Generate a markdown changelog document from a GitHub milestone.

1.4.0(3y ago)10372.7k↓16.7%8[2 PRs](https://github.com/jwage/changelog-generator/pulls)MITPHPPHP ^8.1.0

Since May 19Pushed 3y ago3 watchersCompare

[ Source](https://github.com/jwage/changelog-generator)[ Packagist](https://packagist.org/packages/jwage/changelog-generator)[ Docs](https://www.jwage.com)[ RSS](/packages/jwage-changelog-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (18)Used By (0)

Changelog Generator
===================

[](#changelog-generator)

[![Build Status](https://camo.githubusercontent.com/6ddad9e057bed36f397248a50de709c7dc63fa620f45bf52be0525f0e5858bd2/68747470733a2f2f7472617669732d63692e6f72672f6a776167652f6368616e67656c6f672d67656e657261746f722e737667)](https://travis-ci.org/jwage/changelog-generator)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9b71536ec0ea9ae240decd10ec64fcf9322da9de1a6206c17c57a9f3a9a58f17/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a776167652f6368616e67656c6f672d67656e657261746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jwage/changelog-generator/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/5de7bb6fb254ab9aa178a1b30c020d4fd246c284a0e22736e8e80e34bad87bb9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a776167652f6368616e67656c6f672d67656e657261746f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jwage/changelog-generator/?branch=master)

This library will generate a changelog markdown document from a GitHub milestone. It is based off of [weierophinney/changelog\_generator](https://github.com/weierophinney/changelog_generator).

Features
--------

[](#features)

- [Shows total issues, pull requests and contributors in a GitHub milestone](https://github.com/jwage/changelog-generator#003)
- [Filter by GitHub labels](https://github.com/jwage/changelog-generator#filtering-by-labels)
- [Grouped by GitHub labels](https://github.com/jwage/changelog-generator#003)
- [Write changelog to a file](https://github.com/jwage/changelog-generator#write-to-file)
- [Multi-Project configuration](https://github.com/jwage/changelog-generator#configuration-file)
- [Connects related pull requests and issues to reduce redundant lines in the changelog](https://github.com/jwage/changelog-generator#connecting-issues--pull-requests)
- [GitHub Enterprise Support](https://github.com/jwage/changelog-generator#github-enterprise-support)

Installation
------------

[](#installation)

You can install with composer:

```
$ composer require jwage/changelog-generator

```

Or you can download the latest `changelog-generator.phar` file from the [releases](https://github.com/jwage/changelog-generator/releases) pages.

Example
-------

[](#example)

Here is what an example changelog looks like. It was generated from the `0.0.3` milestone in GitHub for this project:

### 0.0.3

[](#003)

- Total issues resolved: **7**
- Total pull requests resolved: **7**
- Total contributors: **1**

#### Enhancement

[](#enhancement)

- [15: Look for changelog-generator-config.php file by default if no --confi…](https://github.com/jwage/changelog-generator/pull/15) thanks to @jwage
- [13: Allow changelog configurations to be provided via a php config file.](https://github.com/jwage/changelog-generator/pull/13) thanks to @jwage
- [12: Allow changelog to be filtered by label names.](https://github.com/jwage/changelog-generator/pull/12) thanks to @jwage
- [11: Add total contributors to changelog.](https://github.com/jwage/changelog-generator/pull/11) thanks to @jwage
- [9: Improve changelog totals to be split by issue and pull requests.](https://github.com/jwage/changelog-generator/pull/9) thanks to @jwage
- [7: Link pull requests and issues together to improve the changelog format.](https://github.com/jwage/changelog-generator/pull/7) thanks to @jwage
- [6: Allow changelog to be written to a file.](https://github.com/jwage/changelog-generator/pull/6) thanks to @jwage

You can also look at the [CHANGELOG.md](https://github.com/jwage/changelog-generator/blob/master/CHANGELOG.md) file which is generated by this project.

Basic Usage
-----------

[](#basic-usage)

Generate a change log based on a GitHub milestone with the following command:

```
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0

```

Write to File
-------------

[](#write-to-file)

Write the generated changelog to a file with the `--file` option. If you don't provide a value, it will be written to the current working directory in a file named `CHANGELOG.md`:

```
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file

```

You can pass a value to `--file` to specify where the changelog file should be written:

```
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file=changelog.md

```

By default it will overwrite the file contents but you can pass the `--append` option to append the changelog to the existing contents.

```
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file=changelog.md --append

```

If you want to prepend the changelog to an existing file, use the `--prepend` option:

```
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --file=changelog.md --prepend

```

Connecting Issues &amp; Pull Requests
-------------------------------------

[](#connecting-issues--pull-requests)

To make the changelog easier to read, we try to connect pull requests to issues by looking for `#{ISSUE_NUMBER}` in the body of the pull request. When the user of the issue and pull request are different github users, the changelog line will look like the following:

- [634: Fix namespace in bin/doctrine-migrations.php](https://github.com/doctrine/migrations/pull/634) thanks to @Majkl578 and @jwage

Filtering by Labels
-------------------

[](#filtering-by-labels)

You can filter the changelog by label names using the `--label` option:

```
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --label=Enhancement --label=Bug

```

Including Open Issues &amp; Pull Requests
-----------------------------------------

[](#including-open-issues--pull-requests)

It can be convenient when preparing release notes for an upcoming release to include open issues and pull requests. For this you can use the `--include-open` option:

```
$ ./vendor/bin/changelog-generator generate --user=doctrine --repository=migrations --milestone=2.0 --include-open

```

Configuration File
------------------

[](#configuration-file)

You can provide a PHP configuration file to the changelog generator if you don't want to provide the data manually each time. Put the following contents in a file named `config.php`:

```
