samsonphp/composer

Create packages list

1.2.1 2016-03-23 15:19 UTC

This package is not auto-updated.

Last update: 2024-10-26 16:43:59 UTC


README

#SamsonPHP - composer packages list generator

Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality Stories in Ready Total Downloads

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