ion-bazan/composer-diff
Composer 安装命令:
composer require ion-bazan/composer-diff
包简介
Compares composer.lock changes and generates Markdown report so you can use it in PR description.
README 文档
README
Generates packages changes report in Markdown format by comparing composer.lock files. Compares with last-committed changes by default.
Now available as GitHub Action!
Web version available at https://lyrixx.github.io/composer-diff
Installation
composer global require ion-bazan/composer-diff
Usage
composer diff # Displays packages changed in current git tree compared with HEAD composer diff --help # Display detailed usage instructions
Example output
| Prod Packages | Operation | Base | Target |
|---|---|---|---|
| psr/event-dispatcher | New | - | 1.0.0 |
| symfony/deprecation-contracts | New | - | v2.1.2 |
| symfony/event-dispatcher | Upgraded | v2.8.52 | v5.1.2 |
| symfony/event-dispatcher-contracts | New | - | v2.1.2 |
| symfony/polyfill-php80 | New | - | v1.17.1 |
| php | New | - | >=5.3 |
| Dev Packages | Operation | Base | Target |
|---|---|---|---|
| phpunit/php-code-coverage | Downgraded | 8.0.2 | 7.0.10 |
| phpunit/php-file-iterator | Downgraded | 3.0.2 | 2.0.2 |
| phpunit/php-text-template | Downgraded | 2.0.1 | 1.2.1 |
| phpunit/php-timer | Downgraded | 5.0.0 | 2.1.2 |
| phpunit/php-token-stream | Downgraded | 4.0.2 | 3.1.1 |
| phpunit/phpunit | Downgraded | 9.2.5 | 8.5.8 |
| sebastian/code-unit-reverse-lookup | Downgraded | 2.0.1 | 1.0.1 |
| sebastian/comparator | Downgraded | 4.0.2 | 3.0.2 |
| sebastian/diff | Downgraded | 4.0.1 | 3.0.2 |
| sebastian/environment | Downgraded | 5.1.1 | 4.2.3 |
| sebastian/exporter | Downgraded | 4.0.1 | 3.1.2 |
| sebastian/global-state | Downgraded | 4.0.0 | 3.0.0 |
| sebastian/object-enumerator | Downgraded | 4.0.1 | 3.0.3 |
| sebastian/object-reflector | Downgraded | 2.0.1 | 1.1.1 |
| sebastian/recursion-context | Downgraded | 4.0.1 | 3.0.0 |
| sebastian/resource-operations | Downgraded | 3.0.1 | 2.0.1 |
| sebastian/type | Downgraded | 2.1.0 | 1.1.3 |
| sebastian/version | Downgraded | 3.0.0 | 2.0.1 |
| phpunit/php-invoker | Removed | 3.0.1 | - |
| sebastian/code-unit | Removed | 1.0.3 | - |
Options
--base(-b) - path, URL or git ref to originalcomposer.lockfile--target(-t) - path, URL or git ref to modifiedcomposer.lockfile--no-dev- ignore dev dependencies (require-dev)--no-prod- ignore prod dependencies (require)--direct(-D) - only show direct dependencies--with-platform(-p) - include platform dependencies (PHP, extensions, etc.)--with-links(-l) - include compare/release URLs--with-licenses(-c) - include license information--format(-f) - output format (mdtable, mdlist, json, github) - default:mdtable--gitlab-domains- custom gitlab domains for compare/release URLs - default: use composer config
Advanced usage
composer diff master # Compare current composer.lock with the one on master branch composer diff master:composer.lock develop:composer.lock -p # Compare master and develop branches, including platform dependencies composer diff --no-dev # ignore dev dependencies composer diff -p # include platform dependencies composer diff -f json # Output as JSON instead of table
You can find more documentation in the docs directory.
Strict mode
To help you control your dependencies, you may pass --strict option when running in CI. If there are any changes detected, a non-zero exit code will be returned.
Exit code of the command is built using following bit flags:
0- OK.1- General error.2- There were changes in prod packages.4- There were changes is dev packages.8- There were downgrades in prod packages.16- There were downgrades in dev packages.
You may check for individual flags or simply check if the status is greater or equal 8 if you don't want to downgrade any package.
Contributing
Composer Diff is an open source project that welcomes pull requests and issues from anyone. Before opening pull requests, please consider reading our short Contribution Guidelines.
Similar packages
While there are several existing packages offering similar functionality:
- jbzoo/composer-diff - requires PHP 7.2+, no composer plugin support
- josefglatz/composer-diff-plugin - works only right after install/update
- davidrjonas/composer-lock-diff - does not work as composer plugin
This package offers:
- Support for wide range of PHP versions, starting from 5.3.2 up to 8.0 and newer.
- No dependencies if you run it as composer plugin.
- Both standalone executable and composer plugin interface - you choose how you want to use it.
- Allows generating reports in several formats.
- Extra Gitlab domains support.
- GitHub Action with example workflow
- 100% test coverage.
- MIT license.
ion-bazan/composer-diff 适用场景与选型建议
ion-bazan/composer-diff 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.08M 次下载、GitHub Stars 达 187, 最近一次更新时间为 2020 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「composer」 「markdown」 「github」 「diff」 「packagist」 「packages」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ion-bazan/composer-diff 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ion-bazan/composer-diff 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ion-bazan/composer-diff 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Handles basic OAuth/OAuth2 authentication along with classes for common services
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
Adds more BBCode
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
统计信息
- 总下载量: 2.08M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 187
- 点击次数: 31
- 依赖项目数: 1
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-11
