PHP Classes

PHP Show Git Log of Changes: Generate a changelog from a local Git repository

Recommend this page to a friend!

  Author Author  
Picture of DigiLive
Name: DigiLive <contact>
Classes: 2 packages by
Country: The Netherlands The Netherlands
Innovation award
Innovation award
Nominee: 1x


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This package can generate a changelog from a local Git repository.

It can scan the log of commits of a Git repository in the current directory or a given path and extracts the record of changes.

The package can render the log of changes in several formats like HTML or Markdown.

Details

gitChangelog

GitHub release License Codacy Badge

Generate a changelog from git commits of the local repository.

This library parses information which is stored in a Git repository. With this information, it generates a changelog which can be saved to a file. The information is extracted from the branch which is currently checked out.

Take a look at this example. It is the changelog of the GitChangelog repository, build by this library.

If you have any questions, comments or ideas concerning this library, Please consult the Wiki at first. Create a new issue if your concerns remain unanswered.

Features

Main

  • Markdown and Html renderers included.
  • Choose included renderers or create your own.
  • List Tags and their date.
  • List unique commit titles per tag/release.
  • List commit hashes per unique title (optional).
  • Include commit titles (and hashes) of the HEAD revision (E.g. Unreleased changes).
  • Append other content (E.g. An already existing changelog).
  • Save the content of the (appended) changelog to file.

Other

  • Set path to generate a changelog of another local repository.
  • Set a tag range to limit the changelog.
  • Filter titles by labels<sup>1</sup>.
  • Set a title for the changelog (E.g. a header).
  • Set a custom title for the HEAD revision (E.g. Next release version).
  • Set a custom date for the HEAD revision (E.g. Next release date).
  • Set a custom message to indicate there are no commits present.
  • In- or exclude merge commits.
  • Set an ordering key for sorting tags/releases<sup>2</sup>.
  • Set the sort order of tags/releases.
  • Set the sort order of titles.
  1. A label is considered to be the first word of a commit title.
  2. Using an invalid key will result in unlisted changes or when enabled, just the changes of the HEAD revision.

Markdown Renderer

  • Define a custom format for Tag/Release lines.
  • Define a custom format for title lines.
  • Format hashes into links to commit view of the remote repository.
  • Format issues into links to Issue tracker of the repository.

Html Renderer

  • Format hashes into links to commit view of the remote repository.
  • Format issues into links to Issue tracker of the repository.

Installation

The preferred method is to install the library with Composer.

> composer require digilive/git-changelog:^1

Set the version constraint to a value which suits you best. Alternatively you can download the latest release from Github.

Minimal Example use

<?php

use DigiLive\GitChangelog\Renderers\MarkDown;
 
// Use composer's auto loader.
$requiredFile = 'Path/To/vendor/autoload.php';

// Or include the library manually.
// $requiredFile = 'Path/To/MarkDown.php';

require_once $requiredFile;

// Instantiate the library's renderer.
$changelog = new MarkDown();
// Build and save the changelog with all defaults.
$changelog->build();
$changelog->save('CHANGELOG.md');

Notes

  • Some options can be changed directly by setting a public property. (Setting a value of an invalid type, might result in unexpected results.)
  • Others have to be set by calling a method.

Commit guidelines

In order to create a good changelog, you should follow the following guidelines:

  • Commit messages must have a title line and may have body copy. These must be separated by a blank line.
  • The title line must not exceed 50 characters.
  • The title line should be capitalized and must not end in a period.
  • The title line must be written in an imperative mood (Fix, not Fixed / Fixes etc.).
  • The body copy must be wrapped at 72 columns.
  • The body copy must only contain explanations as to what and why, never how. The latter belongs in documentation and implementation.

  Classes of DigiLive  >  PHP Show Git Log of Changes  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP Show Git Log of Changes
Base name: gitchangelog
Description: Generate a changelog from a local Git repository
Version: 1.0.0
PHP version: 7.3
License: Custom (specified in a license file)
 
  Groups   Applications   Files Files  

  Groups  
Group folder image Utilities and Tools General purpose tools to simplify software development View top rated classes
Group folder image PHP 7 Classes using PHP 7 specific features View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (2 files, 1 directory)
Files folder imagetests (5 files)
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  .github  
File Role Description
Files folder imageISSUE_TEMPLATE (2 files)

  Files folder image Files  /  .github  /  ISSUE_TEMPLATE  
File Role Description
  Accessible without login Plain text file bug_report.md Data Auxiliary data
  Accessible without login Plain text file feature_request.md Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageRenderers (3 files)
  Plain text file GitChangelog.php Class Class source
  Plain text file Utilities.php Class Class source

  Files folder image Files  /  src  /  Renderers  
File Role Description
  Plain text file Html.php Class Class source
  Plain text file MarkDown.php Class Class source
  Plain text file RendererInterface.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file GitChangelogTest.php Class Class source
  Plain text file HtmlTest.php Class Class source
  Plain text file MarkDownTest.php Class Class source
  Plain text file UtilitiesTest.php Class Class source

Install with Composer Install with Composer - Download Download all files: gitchangelog.tar.gz gitchangelog.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
For more information send a message to info at phpclasses dot org.