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 Api Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

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:

  • Dependency inventory / license audit — getPackageMetadata() over composer.lock entries gives licenses, versions, abandoned flags, and requirement graphs. Low effort, immediate internal value.
  • Package discovery UI — searchPackagesByName(), searchPackagesByTags(), searchPackagesByType(), getPopularPackages() with pagination. Enough to prototype a catalog, "recommended packages," or a vendor/org showcase page.
  • Security posture reporting* — getAdvisories() and getAdvisoriesAffectingVersions() support "are our pinned versions affected?" dashboards and CI gates.
  • Market/ecosystem signals — 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.

When to Consider This Package

Adopt when all of these hold:

  • You are inside a PHP/Composer ecosystem and already ship Guzzle (or are fine adding it).
  • Your need is read-only, public-packagist.org data — search, metadata, stats, advisories.
  • The consumer is an internal tool, admin panel, CLI command, or CI job, where eventual consistency and occasional 5xx responses are tolerable.
  • You will wrap it in your own service class with caching, retry, timeout, and a User-Agent header — the package gives you none of those.
  • You accept raw array responses and are prepared to map them into your own DTOs.

Look elsewhere (or build directly on Guzzle) when:

  • You need one endpoint only. Calling https://repo.packagist.org/p2/vendor/package.json is a three-line Guzzle call; don't add a dependency for it.
  • You need Laravel-native ergonomics. No service provider, facade, or config ships here. The third-party 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.
  • You need compliance-grade vulnerability management. For production SBOM/CVE gating, use composer audit, Dependabot/Snyk, or Roave's security-advisories — purpose-built, with policy and reporting surfaces this client lacks.
  • You need private repositories, Packagist.com, or authenticated/high-volume access. This client targets the public API only; no auth, no rate-limit handling, no bulk semantics.
  • You need a support contract or guaranteed API stability. Single-maintainer-org OSS with sporadic releases (2.1.x line, no v3); version 2.1.1 shipped a documented B/C break.
  • Ecosystem validation is a gate for you. 132 stars and effectively no dependents means it is not battle-tested at scale — budget for reading the source (it's small enough to audit in an hour) rather than trusting the README.

How to Pitch It (Stakeholders)

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.

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.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin