spatie/packagist-api
Spatie's PHP package makes it easy to search and fetch package info from the Packagist API. Pass a Guzzle client and URL generator to the client, then list package names by type or vendor, fetch popular packages with pagination, and more.
Build vs. buy for ecosystem data plumbing. This package answers one narrow question: do we write our own Packagist HTTP client or adopt one? It ships a PackagistClient with a URL generator and Guzzle injection, mapping ~10 methods onto the public Packagist API (search, popular packages, metadata, download stats, global statistics, security advisories). That's roughly 200 lines of glue you'd otherwise re-derive — plus the maintenance burden of tracking API drift. Decision: adopt, but treat it as a thin adapter, not a platform.
Feature scoping for developer-facing tooling. The method surface tells you exactly which features are cheap to ship:
getPackageMetadata() over composer.lock entries gives licenses, versions, abandoned flags, and requirement graphs. Low effort, immediate internal value.searchPackagesByName(), searchPackagesByTags(), searchPackagesByType(), getPopularPackages() with pagination. Enough to prototype a catalog, "recommended packages," or a vendor/org showcase page.getAdvisories() and getAdvisoriesAffectingVersions() support "are our pinned versions affected?" dashboards and CI gates.getPackageDownloadStats() and getStatistics() give adoption trend data for prioritization decisions (e.g., which integrations deserve investment).Roadmap input, not a roadmap item. Use it to inform decisions — should we surface dependency health in our admin console? Is a package marketplace worth a quarter? — rather than to justify a new product line. It does not differentiate the product; it removes a few weeks of undifferentiated HTTP work.
Talent and risk signals. MIT license, zero infrastructure, no vendor lock-in, no auth, no data storage. The cost of trying it is a single spike day. The cost of reversing it is equally small, which is exactly the profile you want for an exploratory bet.
Adopt when all of these hold:
Look elsewhere (or build directly on Guzzle) when:
https://repo.packagist.org/p2/vendor/package.json is a three-line Guzzle call; don't add a dependency for it.markwalet/laravel-packagist wrapper exists but predates the 2.0 Packagist → PackagistClient rename and the interface overhaul — a manual singleton binding is lower risk than that dependency.composer audit, Dependabot/Snyk, or Roave's security-advisories — purpose-built, with policy and reporting surfaces this client lacks.For executives (30 seconds): We can add dependency intelligence — license inventory, abandoned-package detection, download trends, and security advisories for everything we ship — for roughly one engineer-day of integration and zero infrastructure cost. It's an MIT-licensed, single-purpose client library from a well-known PHP shop. It is not a customer-facing differentiator and it is not a platform commitment; it's cheap instrumentation that makes our supply-chain and build-vs-buy conversations evidence-based. Risk is low and reversible.
For engineering (the honest version): It's a typed-ish wrapper over the public Packagist API — Guzzle in, URL generator in, arrays out. No caching, no retries, no Laravel integration, no DTOs. We bind it as a singleton in AppServiceProvider, wrap it in a PackagistService that owns caching (note: Packagist already caches server-side for 12 hours — that saves their load, not our round trip), timeouts, User-Agent, and exception translation. That wrapper is what we mock in tests. First deliverable: an Artisan command that reads composer.lock and reports licenses, versions, abandoned flags, and advisories. If that proves useful, the search and stats methods are already there for a discovery feature.
Framing to avoid: don't sell this as "we're building a package marketplace." Sell it as the cheapest possible way to find out whether dependency intelligence is worth investing in — and be explicit that if the answer is yes, the eventual build likely outgrows this client and moves to Composer's own audit tooling plus a proper vulnerability feed.
How can I help you explore Laravel packages today?