🏢 ListPackagesByVendor
Fetches all package names under a given vendor.
When to use
🏢 List all packages under an organization, e.g. symfony/*; 🔍 evaluate the ecosystem size of a vendor; 🧩 build a vendor-oriented index page.
Signature
go
func (c *ComposerClient) ListPackagesByVendor(vendor string) (*domain.PackageListResponse, error)Parameters
| Parameter | Type | Description |
|---|---|---|
vendor | string | Vendor name, e.g. symfony, laravel |
Return value
| Value | Type | Description |
|---|---|---|
| Result | *domain.PackageListResponse | PackageNames is the list of package names under that vendor |
| Error | error | Returned on HTTP failure, non-200 status, or JSON parse failure |
Corresponding endpoint: GET https://packagist.org/packages/list.json?vendor={vendor}. The SDK automatically URL-encodes vendor.
Example
go
package main
import (
"fmt"
"log"
"time"
"github.com/scagogogo/composer-skills/pkg/client"
)
func main() {
c := client.NewComposerClient(30 * time.Second)
resp, err := c.ListPackagesByVendor("symfony")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Package count under symfony: %d\n", len(resp.PackageNames))
for _, name := range resp.PackageNames[:5] {
fmt.Println(" -", name)
}
}Advanced
- 🧩 To filter by package type, use
ListPackagesByType. - 📋 To get the full list of package names, use
ListPackages. - 📦 To also get fields such as the repository URL, use
ListPackagesWithData.