-
Notifications
You must be signed in to change notification settings - Fork 0
2 Getting Started
The preferred method is to install the library with Composer.
composer require digilive/git-changelog: ^2
(Choose a version constraint which suits your needs.)
Alternatively, you can download the latest release from GitHub.
Instantiating the library's generator will provide you all necessary properties and methods to parse the commit data of
your repository.
However, the generator on its own won't render anything.
Invoke method GitChangelog::fetchCommitData($force = false)
to fetch an array of commit data which can be used to
create your own output.
Alternatively you can create your own renderer class by extending GitChangelog
and implementing RendererInterface
.
E.g. class myRenderer extends GitChangelog implements RendererInterface
This way the library can be instantiated as described in this chapter.
Currently, there are two renderers included. One generates a changelog in Markdown format and one that generates HTML.
Instantiate the library by instantiating a renderer directly.
The renderer extends the generator and therefore includes all necessary properties and methods.
Additionally, the renderer provides method build()
and several new options.
- Visit Public Methods to learn about the
build()
method. - Visit Options to learn about the additional options.
<?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');