📚 SDK Reference
Composer Skills provides two SDKs plus a set of foundation-layer modules. Choose based on your needs:
| SDK | Package path | Use case | Needs PHP? |
|---|---|---|---|
| 🌐 Packagist API SDK | pkg/client, pkg/repository | Search packages, get statistics, security advisories, package management | ❌ No (pure Go) |
| 🛠️ Composer CLI SDK | pkg/composer | Local operations: install/update/require/audit/validate, etc. | ✅ Yes |
Foundation layer
| Module | Package path | Description |
|---|---|---|
| 🔍 Detector | pkg/detector | Cross-OS detection of the Composer install location |
| 📦 Installer | pkg/installer | Auto-install Composer + PHP |
| 🏷️ Domain | pkg/domain | Data structures for the Packagist API |
| 🧰 ComposerUtils | pkg/composerutils | Filesystem, HTTP, mock, and test helpers |
How to choose
- Only querying Packagist → use the Packagist API SDK; no PHP environment needed.
- Operating on a local PHP project → use the Composer CLI SDK; 234 methods cover every Composer command.
- Not sure whether Composer is installed → start with the Detector; if missing, use the Installer to auto-install.
Quick comparison
go
// Packagist API SDK — pure Go, no PHP
c := client.NewComposerClient(30 * time.Second)
pkg, _ := c.GetPackage("monolog/monolog")
// Composer CLI SDK — operates on a local project
comp, _ := composer.New(composer.DefaultOptions())
comp.Install(false, true)
result, _ := comp.AuditWithJSON()See each module's docs for details.