1. Go to this page and download the library: Download shyim/danger-php 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/ */
shyim / danger-php example snippets
declare(strict_types=1);
use Danger\Config;
use Danger\Rule\DisallowRepeatedCommits;
return (new Config())
->useRule(new DisallowRepeatedCommits) // Disallows multiple commits with the same message
;
declare(strict_types=1);
use Danger\Config;
use Danger\Rule\MaxCommit;
return (new Config())
->useRule(new MaxCommit(1))
;
declare(strict_types=1);
use Danger\Config;
use Danger\Context;
return (new Config())
->useRule(function (Context $context): void {
if (!$context->platform->pullRequest->getFiles()->has('CHANGELOG.md')) {
$context->failure('Please edit also the CHANGELOG.md');
}
})
;
declare(strict_types=1);
use Danger\Config;
use Danger\Context;
return (new Config())
->useRule(function (Context $context): void {
if (count($context->platform->pullRequest->assignees) === 0) {
$context->warning('This PR currently doesn\'t have an assignee');
}
})
;
bash
composer global
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.