PHP code example of emlynwest / changelog

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

    

emlynwest / changelog example snippets




// Create a new change log and set a title and description.
$log = new \ChangeLog\Log();
$log->setTitle('My Project Change Log');
$log->setDescription('This is my project\'s change log. Any crazy stuff that happens will appear here.');

// Create and add a new release.
$release1 = new \ChangeLog\Release('1.0.0');
$release1->addChange('Added', 'Awesome feature needed for release');
$log->addRelease($release1);

$release2 = new \ChangeLog\Release('0.3.0');
$release2->addChange('Added', 'Finally added a change log');
$release2->setChanges('Fixed', [
	'Bug 1',
	'Bug 2',
	'Bug 3',
]);
$log->addRelease($release2);



$input = new \ChangeLog\IO\File([
	'file' => 'path/to/changelog.md'
]);

$parser = new \ChangeLog\Parser\KeepAChangeLog();

$cl = new \ChangeLog\ChangeLog;
$cl->setParser($parser);
$cl->setInput($input);

$log = $cl->parse();

// Instance of ChangeLog\Log
var_dump($log);



$output = new \ChangeLog\IO\File([
	'file' => 'path/to/changelog.md'
]);

$renderer = new \ChangeLog\Renderer\KeepAChangeLog();

$cl = new \ChangeLog\ChangeLog;
$cl->setRenderer($renderer);
$cl->setOutput($output);

$log = new Log;
// Build up the log file information here

$cl->write($log);

$log1 = new Log;
// Add some releases or something

$log2 = new Log;
// Add some releases to this too

$log1->mergeLog($log2);
// $log1 now contains all releases and changes from $log2