samsonphp / composer
Create packages list
Installs: 7 211
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 2
Open Issues: 6
Requires (Dev)
- phpunit/phpunit: 4.*
- samsonphp/event: 1.*
- satooshi/php-coveralls: dev-master
README
#SamsonPHP - composer packages list generator
Module creates an ordered list of projects composer packages sorted by priority.
Priority is automatically determined by the dependencies between packages, this dependecies usually located at composer.json
in project root folder. If a package package_A
requires package package_B
, then package package_B
priority is higher then package package_A
priority.
This approach gives ability to build dependency tree from all composer loaded packages and represent it as a list. This is usefull when you tring to customly build package loading logic based on composer.
Usage
To work with this module you should get composer instance:
$composer = new \samsonos\composer\Composer();
Use following methods to configure module:
addVendor($vendor)
- Add available vendor ($vendor
is the available vendor)setIgnoreKey($ignoreKey)
- Set name of composer extra parameter to ignore package ($ignoreKey
is name). Composer usage example:"extra": { "samson_module_ignore": "1" }
($composer->setIgnoreKey('samson_module_ignore')
)setIncludeKey($includeKey)
- Set name of composer extra parameter to include package ($includeKey
is name). Composer usage example:"extra": { "samson_module_include": "1" }
($composer->setIncludeKey('samson_module_include')
)addIgnorePackage($package)
- Add ignored package ($package
is the ignored package)
To create sorted list of project composer packages you can use method
$composer->create($systemPath, $lockFileName)
$systemPath
- Path to current web-application$lockFileName
- Composer lock file name (by default is set to'composer.lock'
)
Example usage:
$composer = new \samsonos\composer\Composer($systemPath); $composerModules = $composer ->addVendor('samsonos') ->setIgnoreKey('samson_module_ignore') ->addIgnorePackage('samsonos/php_core') ->addIgnorePackage('samsonos/php_event') ->create();
Developed by SamsonOS