artgris/version-checker-bundle
composer require artgris/version-checker-bundle
config/bundles.php (Symfony 4+) or app/AppKernel.php (Symfony 2/3):
Artgris\VersionCheckerBundle\ArtgrisVersionCheckerBundle::class => ['all' => true],
config/routes/dev/artgris_version_checker.yaml (Symfony 4+):
artgris_version_checker:
resource: "@ArtgrisVersionCheckerBundle/Resources/config/routing.yml"
For Symfony 2/3, add to app/config/routing_dev.yml:
_artgris_version_checker:
resource: "@ArtgrisVersionCheckerBundle/Resources/config/routing.yml"
version_checker_service and call:
$versions = $this->get('version_checker_service')->versionChecker();
{{ version_checker() }}
Dependency Check in CI/CD Integrate the service into a custom command to fail builds if outdated packages exceed a threshold:
$outdated = array_filter($versions, fn($v) => $v['yourVersion'] !== $v['gitHubVersion']);
if (count($outdated) > 5) {
throw new \RuntimeException("Too many outdated packages!");
}
Dynamic Dashboard Use the Twig extension to display package versions in an admin dashboard:
{% for package, data in version_checker() %}
<div class="package {{ 'outdated' if data.yourVersion != data.gitHubVersion }}">
{{ package }}: {{ data.yourVersion }} (Latest: {{ data.gitHubVersion }})
</div>
{% endfor %}
Scheduled Checks
Cache results for 24 hours (adjust lifetime in config) to avoid hitting GitHub API limits:
artgris_version_checker:
lifetime: 86400 # 24 hours
config/packages/artgris_version_checker.yaml for config.{% macro outdatedPackages(versions) %}
{% set outdated = versions|filter((v) => v.yourVersion != v.gitHubVersion) %}
{{ outdated|length }} packages outdated.
{% endmacro %}
access_token if using >60 packages (generate via GitHub Tokens).GitHub API Limits
access_token in config for production/dev environments with many dependencies.repo scope.Private Packages
The bundle only checks public GitHub repositories. Private packages will show No release found.
Composer Lock Parsing
dev-master or * versions in composer.lock. Only compares semantic versions.Caching Issues
php bin/console cache:clear) if versions appear stale despite lifetime settings.$this->get('version_checker_service')->getCacheKey();
$client = $this->get('version_checker_service')->getGitHubClient();
$client->setHandler(new \GuzzleHttp\HandlerStack([
new \GuzzleHttp\Middleware::tap(function ($request) {
error_log("GitHub API Request: " . $request->getUri());
}),
]));
composer.lock: Ensure the file is up-to-date (composer update --lock).Custom Version Sources Override the service to fetch versions from other sources (e.g., Packagist API):
class CustomVersionChecker extends VersionCheckerService
{
public function getGitHubVersion($packageName)
{
// Custom logic here
}
}
Register as a service with version_checker_service alias.
Webhook Triggers Use the service in a webhook endpoint to notify admins of updates:
$newUpdates = array_filter($versions, fn($v) => $v['gitHubVersion'] > $v['yourVersion']);
if (!empty($newUpdates)) {
$this->get('mailer')->send(new UpdateNotificationEmail($newUpdates));
}
UI Customization
Override the Twig template (Resources/views/VersionChecker/version_checker.html.twig) to add:
v2.5.6 → v2.5.7).data.url).How can I help you explore Laravel packages today?