jean85/pretty-package-versions
Lightweight wrapper to fetch human-friendly version strings for installed Composer dependencies. Works across Composer 1 and 2 with a smooth upgrade path, using the appropriate backend (InstalledVersions or package-versions-deprecated) as needed.
Architecture fit: The package is a lightweight, dependency-free wrapper designed to abstract Composer version handling differences between v1 and v2. It integrates seamlessly into Laravel applications for version display (e.g., debug panels, health checks) without introducing runtime overhead or architectural complexity. Its single-class design aligns with Laravel's service-oriented structure.
Integration feasibility: High. Requires only composer require with version constraint ^1.5 || ^2.0. No configuration needed – static methods (PrettyVersions::getVersion()) work immediately after installation. Zero additional dependencies beyond Composer itself. Fully compatible with Laravel's Composer-based dependency management.
Technical risk: Low. Actively maintained with recent PHP 8.4 support and Composer 2.x compatibility. Historical issues (e.g., Composer 2.0.14 deprecations) were promptly resolved. Primary risk is edge-case handling for replaced/provided packages, but the package explicitly throws ProvidedPackageException/ReplacedPackageException for safe handling. Low dependency count (0) suggests minimal transitive risk.
Key questions:
VersionMissingExceptionInterface exceptions for replaced/provided packages in error logging?Stack fit: Ideal for Laravel applications. Works natively with Composer's InstalledVersions class and Laravel's dependency management system. No conflicts with framework components – purely a utility for version string formatting in controllers, CLI commands, or logging.
Migration path:
ocramius/package-versions with jean85/pretty-package-versions via Composer.getCommitHash() → getReference()).PackageVersions\Versions::ROOT_PACKAGE_NAME to PrettyVersions::getRootPackageName().ProvidedPackageException/ReplacedPackageException where needed.Compatibility: Fully compatible with Laravel 9+ (PHP 8.0+). Works with Composer 2.1.0+ (2.1.0+ releases) or Composer 1.x (via 1.5+). No Laravel-specific dependencies – pure PHP utility.
Sequencing:
composer.json and run composer update.PrettyVersions::getVersion() calls.dev-master, RC releases, replaced packages).Maintenance: Minimal overhead. Small codebase (≈500 LOC) with comprehensive tests (95%+ coverage). Active maintenance with recent releases (2
How can I help you explore Laravel packages today?