PHP code example of ins0 / github-changelog-generator

1. Go to this page and download the library: Download ins0/github-changelog-generator 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/ */

    

ins0 / github-changelog-generator example snippets



en = '...';   // The token is not y('ins0/github-changelog-generator', $token);
$changelog = new ins0\GitHub\ChangelogGenerator($repository);

// The ChangelogGenerator::generate() method does throw
// exceptions, so remember to wrap your code in try/catch blocks.
try {
    $handle = fopen('CHANGELOG.md', 'w');

    if (!$handle) {
        throw new RuntimeException('Cannot open file for writing');
    }

    // Write markdown output to file
    fwrite($handle, $changelog->generate());
    fclose($handle);
} catch (Exception $e) {
    // handle exceptions...
}



$labelMappings = [
    ins0\GitHub\ChangelogGenerator::LABEL_TYPE_ADDED => ['feature', 'anotherFeatureLabel'],
    ins0\GitHub\ChangelogGenerator::LABEL_TYPE_CHANGED => ['enhancement', 'anotherEnhancementLabel'],
    ins0\GitHub\ChangelogGenerator::LABEL_TYPE_FIXED => ['bug', 'anotherBugLabel']
];

$changelog = new ins0\GitHub\ChangelogGenerator($repository, $labelMappings);



$typeHeadings = [
    ins0\GitHub\ChangelogGenerator::LABEL_TYPE_ADDED => '### New stuff!'
];

$changelog = new ins0\GitHub\ChangelogGenerator($repository, [], $labelHeaders);