PHP code example of subdee / gitlab-chlog

1. Go to this page and download the library: Download subdee/gitlab-chlog library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

subdee / gitlab-chlog example snippets



GitlabChangelog\GitlabChangelog;

$changelog = new GitlabChangelog();
$changelog->url = "GITLAB URL";
$changelog->repo = "REPO NAME";
$changelog->token = "YOUR PRIVATE TOKEN";

$changelog->getLabels = function($issue) {
    $label = "Fixed";
    $map = array(
        "bug" => "Fixed",
        "enhancement" => "Improved",
        "feature" => "Added"
    );
    foreach($map as $k => $v) {
        if(strripos(implode(',', $issue->labels), $k) !== FALSE) {
            $label = $v;
            break;
        }
    }
    return array($label);
};

$markdown = $changelog->markdown();

file_put_contents("changelog.md", $markdown);
shell
composer install
php index.php