Weave 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

Packagist Client Laravel Package

jordanpartridge/packagist-client

A lightweight PHP client for the Packagist API that lets Laravel and PHP apps query package metadata, versions, and download stats through a simple, expressive wrapper. Clean Laravel integration with config and service container support.

View on GitHub
Deep Wiki
Context7

Getting Started

This is the first tagged release (v0.1.0a) of jordanpartridge/packagist-client, so treat everything below as a baseline to diff future releases against — the release notes contain only a changelog link, meaning there is no documented feature list, migration path, or stability guarantee yet. Verify the public surface yourself before designing around it.

  1. composer require jordanpartridge/packagist-client:0.1.0a — pin the exact alpha version, do not use ^0.1 if you care about reproducibility.
  2. Check composer.json for the Laravel version constraint and whether the service provider is auto-discovered (extra.laravel.providers / aliases). If not, register it manually in config/app.php.
  3. Run php artisan vendor:publish --provider="...ServiceProvider" and inspect the resulting config/packagist.php for base URI, cache TTL, timeout, and any token/User-Agent settings.
  4. Read src/ for the entry point (client class or facade) and tests/ for the intended calling convention — the tests are the most reliable documentation at this stage.

First use case: resolve a package's metadata (latest stable version, description, repository URL, download counts) for a single vendor/name pair and dump it in php artisan tinker. That confirms wiring, transport, and response shape in one step before you build anything on top.

Implementation Patterns

Wrap it in your own adapter. Do not inject the package's client directly into controllers, commands, or jobs. Put a small PackagistRepository/PackageInfo interface in your domain layer and implement it with the package. Alpha clients rename classes; your adapter absorbs that.

Prefer constructor injection over the facade in anything you intend to test. If the package only exposes a facade, bind your adapter in a service provider and keep the facade usage confined to that one implementation class.

Cache aggressively at your boundary, not theirs. Packagist data changes on the order of minutes-to-hours, not seconds. Wrap calls in Cache::remember() with a key that includes the package name and the stability flag, and set TTL from your own config rather than relying on any package-level default (which may be absent in a 0.1.0).

Bulk work belongs in queued jobs. If you are auditing many dependencies — checking for abandoned packages, outdated constraints, or unmaintained transitive deps — dispatch one job per package with ->delay() spread across time. This keeps you under rate limits and makes retries granular and observable.

A natural integration point is a Composer-adjacent Artisan command. Read composer.lock, extract packages[].name, resolve each against the client, and emit a table or JSON report. Schedule it weekly and diff against the previous run to surface newly abandoned or yanked packages.

In tests, fake the HTTP layer. Http::fake() with fixture JSON is far more reliable than hitting the network, and it lets you assert the exact request URI and headers your adapter produces.

Gotchas and Tips

  • Alpha API instability is the headline risk. 0.1.0a with an empty changelog means method signatures, return types (array vs DTO), and config keys can all move. Pin the version, keep the adapter thin, and re-read the source on every bump rather than assuming semver protects you.
  • Packagist requires an identifying User-Agent. Requests without one that names your application and a contact URL are liable to be blocked or throttled. Set it in config or per-request; verify the package does not ship a generic default.
  • Handle 404 for unknown packages explicitly. vendor/name typos and private packages not on Packagist both produce a not-found response — do not let it throw an unhandled exception into a loop over composer.lock.
  • Distinguish stable from dev versions. Most metadata endpoints return dev branches alongside releases. Decide whether you want latest, latest-stable, or a version satisfying a constraint, and be explicit — the default may not be what you expect.
  • Watch for 429s and add backoff. If the client has no retry logic, wrap calls in Http::retry() or your own retry loop; bulk scans over a few hundred packages will hit limits otherwise.
  • Cache invalidation on constraint changes. If you cache "latest version satisfying ^8.0", the constraint must be part of the cache key, or a dependency bump will silently serve stale results.
  • Check whether abandonment and download stats come from the same endpoint. The package metadata endpoint and the statistics endpoint are different resources; the client may expose only one in this release. Confirm before promising a "downloads" column in a report.
  • Extension point to look for: whether the underlying HTTP client is resolvable from the container. If it is injected rather than instantiated internally, you can attach middleware for logging, metrics, and retries without forking — if it is not, request that in an issue, since it is the single highest-value change for a package like this.
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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator