shyim/danger-php
Port of danger to PHP
Maintainers
0.3.12
2026-03-20 03:44 UTC
Requires
- php: ^8.2
- ext-ctype: *
- ext-intl: *
- ext-mbstring: *
- knplabs/github-api: ^3.16
- m4tthumphrey/php-gitlab-api: ^12.0
- nyholm/psr7: ^1.8
- symfony/config: ^7.2
- symfony/console: ^7.2
- symfony/dependency-injection: ^7.2
- symfony/filesystem: ^7.2
- symfony/finder: ^7.2
- symfony/http-client: ^7.2
- symfony/process: ^7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: dev-master
- infection/infection: ^0.29.14
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2
- phpstan/phpstan-phpunit: ^2
- phpstan/phpstan-strict-rules: ^2
- phpunit/phpunit: ^11.5
Suggests
None
Provides
None
Conflicts
None
mit 055d1f728c00b9a3d57f630b7507947fa9122380
- Soner Sayakci <github.woop@shyim.de>
This package is auto-updated.
Last update: 2026-06-24 07:33:15 UTC
README
Danger runs during your CI process, and gives teams the chance to automate common code review chores. This project ports Danger to PHP.
Currently only GitHub and Gitlab are supported as Platform
Badges
Installation
Composer
Install danger-php using Composer
composer global require shyim/danger-php
Phar Archive
Every release has a phar archive attached
Docker
Use the prebuilt Docker image
Documentation
Disallow multiple commits with same message
<?php declare(strict_types=1); use Danger\Config; use Danger\Rule\DisallowRepeatedCommits; return (new Config()) ->useRule(new DisallowRepeatedCommits) // Disallows multiple commits with the same message ;
Only allow one commit in Pull Request
<?php declare(strict_types=1); use Danger\Config; use Danger\Rule\MaxCommit; return (new Config()) ->useRule(new MaxCommit(1)) ;
Check for modification on CHANGELOG.md
<?php 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'); } }) ;
Check for Assignee in PR
<?php 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'); } }) ;
