fastframe / composer-packages
Composer plugin to lookup vendor package roots
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Type:composer-plugin
Requires
- php: ^7.2 || ^8.0
- composer-plugin-api: ^1.0 || ^2.0
- psr/container: ^1.0 || ^2.0
Requires (Dev)
- composer/composer: ~1 || ~2
- mikey179/vfsstream: ^1.6
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9
- syberisle/coding-standards: ^2
This package is auto-updated.
Last update: 2024-11-09 19:34:33 UTC
README
This plugin provides an easy method of determining the installation path, name, version, and extra attributes of a given Composer package, by name.
Use this to locate vendor package roots. Most of the times this is going to be used for template files, or other types of assets that you want to get from a package.
Running composer install
or composer update
will trigger the Packages.php to be generated, this contains a registry
of the package installation paths as well as their types.
Installation
composer require fastframe/composer-packages
Usage
$container = new FastFrame\Composer\Packages\Container(); $container->has('fastframe/composer-packages'); // true $container->has('non-existent/package'); // false $pkg = $container->get('fastframe/composer-packages'); // Package object // Package object $pkg->name(); // fastframe/composer-packages $pkg->type(); // composer-plugin $pkg->version(); // 1.0.0.0 $pkg->path(); // {root_path}/vendor/fastframe/composer-packages $pkg->extra(); // array('class' => 'FastFrame\\Composer\\Packages\\Plugin') $pkg->composerJson(); // the json decoded composer.json contents from the package // finding all packages of a specific type $composer_plugins = $container->getByType('composer-plugins'); // array('fastframe-composer-packages')
Inspiration
This plugin was inspired by: