Switon's Composer plugin and runtime reader for cached extra metadata.
- Cached package metadata: composer install and update keep one shared metadata cache current.
- Runtime access:
ComposerExtraInterfacereads discovery data without extra parsing. - Discovery support:
extra.switon.*can feed providers, commands, listeners, tasks, and jobs. - Automatic refresh: the Composer plugin keeps the cache fresh.
- Safe health checks: cache status can be checked without throwing.
composer require switon/composer-extrause Switon\ComposerExtra\ComposerExtraInterface;
use Switon\Core\Attribute\Autowired;
final class PackageRegistry
{
#[Autowired] protected ComposerExtraInterface $composerExtra;
public function listeners(): array
{
return $this->composerExtra->collect('switon.listeners');
}
public function cacheHealth(): array
{
return $this->composerExtra->health();
}
}Docs: https://docs.switon.dev/latest/composer-extra
MIT.