switon / composer-extra
Cached Composer extra metadata reader for fast framework discovery at runtime for Switon Framework
Package info
github.com/switon-php/composer-extra
Type:composer-plugin
pkg:composer/switon/composer-extra
v1.0.0
2026-06-06 13:43 UTC
Requires
- php: >=8.3
- composer-plugin-api: ^2.0
- ext-json: *
- switon/core: ^1.0
Requires (Dev)
- composer/composer: ^2.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^12.0
README
Switon's Composer plugin and runtime reader for cached extra metadata.
Highlights
- 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.
Installation
composer require switon/composer-extra
Quick Start
use 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
License
MIT.