Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Version Checker Bundle Laravel Package

artgris/version-checker-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Install the Bundle
    composer require artgris/version-checker-bundle
    
  2. Enable the Bundle Add to config/bundles.php (Symfony 4+) or app/AppKernel.php (Symfony 2/3):
    Artgris\VersionCheckerBundle\ArtgrisVersionCheckerBundle::class => ['all' => true],
    
  3. Add Routing (Dev Only) Include in 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"
    

First Use Case

  • Debug Toolbar Integration: Visit any page in dev mode to see the "Version Checker" tab in the Symfony Profiler.
  • Service Usage: Inject version_checker_service and call:
    $versions = $this->get('version_checker_service')->versionChecker();
    
  • Twig Usage: Use in templates:
    {{ version_checker() }}
    

Implementation Patterns

Workflows

  1. 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!");
    }
    
  2. 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 %}
    
  3. Scheduled Checks Cache results for 24 hours (adjust lifetime in config) to avoid hitting GitHub API limits:

    artgris_version_checker:
        lifetime: 86400  # 24 hours
    

Integration Tips

  • Symfony 4+ Flex: Use config/packages/artgris_version_checker.yaml for config.
  • Custom Twig Filters: Extend the Twig extension to highlight critical updates:
    {% macro outdatedPackages(versions) %}
        {% set outdated = versions|filter((v) => v.yourVersion != v.gitHubVersion) %}
        {{ outdated|length }} packages outdated.
    {% endmacro %}
    
  • API Rate Limits: Always configure access_token if using >60 packages (generate via GitHub Tokens).

Gotchas and Tips

Pitfalls

  1. GitHub API Limits

    • Unauthenticated requests fail after 60 packages. Always set access_token in config for production/dev environments with many dependencies.
    • Token abuse may temporarily block your IP. Use a personal access token with repo scope.
  2. Private Packages The bundle only checks public GitHub repositories. Private packages will show No release found.

  3. Composer Lock Parsing

    • Ignores dev-master or * versions in composer.lock. Only compares semantic versions.
    • Workaround: Manually exclude problematic packages via a custom service wrapper.
  4. Caching Issues

    • Clear cache (php bin/console cache:clear) if versions appear stale despite lifetime settings.
    • Debug cache keys with:
      $this->get('version_checker_service')->getCacheKey();
      

Debugging

  • Log API Errors: Extend the service to log GitHub API failures:
    $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());
        }),
    ]));
    
  • Verify composer.lock: Ensure the file is up-to-date (composer update --lock).

Extension Points

  1. 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.

  2. 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));
    }
    
  3. UI Customization Override the Twig template (Resources/views/VersionChecker/version_checker.html.twig) to add:

    • Version diffs (e.g., v2.5.6 → v2.5.7).
    • Direct links to GitHub releases (data.url).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui