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.jsonand optionally runcomposer 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.jsonand runcomposer update:
php artisan packagist:check --composer --update --apply
Options
--composer: Read packages from localcomposer.jsonrequire/require-dev--installed: Read installed packages fromcomposer.lockorvendor/composer--outdated: Show only packages that are outdated--include-prereleases: Consider prerelease tags (useLatest (any)for outdated checks)--update: Propose updates incomposer.json--update-all: Shortcut for--composer --update--apply: After updatingcomposer.json, runcomposer updateto install new versions--dry-run: Do not write changes tocomposer.json--no-dev: Excluderequire-devwhen 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-prereleasesto make the command consider prerelease tags when determining whether a package is "outdated" (it will compare against theLatest (any)column which may include prerelease tags). - Note: As of this release the
--include-prereleasesflag affects only the outdated detection and filtering. The--updateproposal 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).
- Use
- The tool creates a timestamped backup of
composer.jsonbefore 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 incomposer.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.jsonchanges 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\HttpClientInterfacein the service provider so theCheckPackagistcommand 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-Lengthheader 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 raisesmemory_limitduring execution as a pragmatic fallback. - Atomic Writes: When proposing and applying
composer.jsonupdates the command creates a timestamped backup and uses a temp file + exclusive lock + atomicrename()to avoid corruptingcomposer.jsonon failure. - Semver policy: The default behavior is conservative — pre-release tags are ignored when forming
^<version>constraints. Handling for0.xpackages and configurable constraint policies are TODOs (see project TODO list). - Testing: Unit tests mock
HttpClientInterfaceand exercisefetchPackage()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
-vflag. 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(updatecomposer.jsonauthor/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 runningphpstanfor 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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pixovoid/packagist-version-checker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Collection of handy Laravel artisan commands that most projects needs
Additional artisan commands for Laravel
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Enterprise-Grade Modular Architecture for Laravel Applications - A powerful Laravel package that revolutionizes application development with robust Service Repository Pattern, Dynamic Module Management, and 50+ Artisan commands for scalable, maintainable applications.
Simple ASCII output of array data
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-08