pixovoid/packagist-version-checker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pixovoid/packagist-version-checker

Composer 安装命令:

composer require pixovoid/packagist-version-checker

包简介

Laravel Artisan command to compare installed Composer package versions with Packagist and help update composer.json

README 文档

README

Artisan (Laravel) command to inspect Composer packages against Packagist and help update composer.json.

Features

  • List installed packages and their installed versions
  • Show latest versions available on Packagist
  • Show which packages are outdated
  • Propose updates to composer.json and optionally run composer update

Installation

Require the package via Composer:

composer require pixovoid/packagist-version-checker

Quick setup for development

composer install
composer test

Usage examples

  • Check a single package:
php artisan packagist:check vendor/name
  • Check all requirements from composer.json:
php artisan packagist:check --composer
  • Check installed packages (reads composer.lock / vendor):
php artisan packagist:check --installed
  • Show only outdated packages:
php artisan packagist:check --installed --outdated
  • Propose updates to composer.json (dry run):
php artisan packagist:check --composer --update --dry-run
  • Apply updates to composer.json and run composer update:
php artisan packagist:check --composer --update --apply

Options

  • --composer : Read packages from local composer.json require/require-dev
  • --installed: Read installed packages from composer.lock or vendor/composer
  • --outdated: Show only packages that are outdated
  • --include-prereleases: Consider prerelease tags (use Latest (any) for outdated checks)
  • --update: Propose updates in composer.json
  • --update-all: Shortcut for --composer --update
  • --apply: After updating composer.json, run composer update to install new versions
  • --dry-run: Do not write changes to composer.json
  • --no-dev: Exclude require-dev when reading/updating

Behaviour & notes

  • The command compares installed/required versions with the latest stable versions on Packagist and proposes constraints using a ^<latest-stable> heuristic.
  • Pre-release tags (for example 1.2.3-beta) are treated conservatively and are not used to form constraints by default.
    • Use --include-prereleases to make the command consider prerelease tags when determining whether a package is "outdated" (it will compare against the Latest (any) column which may include prerelease tags).
    • Note: As of this release the --include-prereleases flag affects only the outdated detection and filtering. The --update proposal logic still forms ^<latest-stable> constraints by default. If you want updates proposed/applied based on prereleases too, enable that explicitly (I can add that behavior on request).
  • The tool creates a timestamped backup of composer.json before writing (e.g. composer.json.bak.20251231235959).
  • Network requests use a short timeout and a small retry/backoff strategy; Packagist responses are validated before use.

Requirements

  • PHP: ^8.4

Dependencies

  • Runtime: illuminate/support (as declared in composer.json)
  • Network and version handling: symfony/http-client (used for Packagist requests)
  • Semver comparisons: composer/semver (used when available for robust comparisons)

Development & testing

Install dependencies and run tests:

composer install
composer test

To run the command locally while developing the package, register it in your application or run it from a Laravel app that includes this package via path repository.

Security & disclaimer

  • This package is provided "as is" without warranties. Use at your own risk. The author and contributors are not liable for damages resulting from its use.
  • Always review proposed composer.json changes and test them in a safe environment before applying to production. The command creates backups automatically.

Support & Contributing

Report issues or feature requests on GitHub: https://github.com/PixoVoid/packagist-version-checker/issues

Contributions are welcome. Please open pull requests against the main branch and follow the project's coding standards.

License

MIT — see the LICENSE file for details.

Implementation Notes

  • HttpClient DI: The package binds Symfony\Contracts\HttpClient\HttpClientInterface in the service provider so the CheckPackagist command receives a client instance via constructor injection. This makes the command easy to test and lets applications provide custom HTTP client configuration.
  • Streaming & Memory: Packagist responses are read in a defensive way: the command checks the Content-Length header and streams responses in small chunks (with a hard safety limit of 1 MB) to avoid exhausting PHP memory. For environments that still encounter large compressed responses, the command temporarily raises memory_limit during execution as a pragmatic fallback.
  • Atomic Writes: When proposing and applying composer.json updates the command creates a timestamped backup and uses a temp file + exclusive lock + atomic rename() to avoid corrupting composer.json on failure.
  • Semver policy: The default behavior is conservative — pre-release tags are ignored when forming ^<version> constraints. Handling for 0.x packages and configurable constraint policies are TODOs (see project TODO list).
  • Testing: Unit tests mock HttpClientInterface and exercise fetchPackage() logic. Reflection-based access was replaced with a small test subclass to avoid PHP 8.5 deprecation warnings.

Debugging & Troubleshooting

  • If you see an OOM (out-of-memory) error when running the command against many or very large packages, try running with a higher memory limit:
php -d memory_limit=512M artisan packagist:check --installed --outdated
  • For verbose diagnostic output use the -v flag. The command emits information about HTTP status, retry timing and when responses are skipped because they exceed the safety limit.

Publishing Notes

  • Package name: pixovoid/packagist-version-checker (update composer.json author/description if required before publishing).
  • Recommended pre-publish checklist: run composer test, add a GitHub Actions workflow to run tests on push/PR, and consider running phpstan for static checks.

pixovoid/packagist-version-checker 适用场景与选型建议

pixovoid/packagist-version-checker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 81 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「composer」 「laravel」 「artisan」 「packagist」 「version-checker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 pixovoid/packagist-version-checker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pixovoid/packagist-version-checker 我们能提供哪些服务?
定制开发 / 二次开发

基于 pixovoid/packagist-version-checker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 81
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-08