PHP Class Package2XmlToComposer, horde

Elements not typically found in package.xml files can be set (or overridden) using methods or a config JSON file. Yes, some of this capability is present in Composer itself, given Composer's ability to install PEAR packages. However, Composer relies on PEAR channels, meaning using Composer's classes for this capability would require developers supporting PEAR and Composer to first publish their packages to their channel and then generate composer.json files afterwards. Using this class, and in particular, the package2composer script that leverages this class, developers are able to use the package.xml file they're using with PEAR's package command to generate a composer.json, which allows a one-stage release workflow to be scripted.
Exibir arquivo Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$output_file

Protected Properties

Property Type Description
$autoload
$bin_files
$branch_alias
$config
$data
$dependency_map
$extra
$extra_suggestions
$homepage
$include_path
$keywords
$license
$name
$package2file_path
$repositories * Horde
$support
$type
$write_time_to_composer
$write_version_to_composer
$xml

Public Methods

Method Description
__construct ( $package2file, $config = null )
convert ( $output_file = null )
getParsedPackageData ( ) : array Allow retrieval of parsed data structure.
help ( ) Help output for CLI version
main ( ) Main method that starts conversion from the command-line
outputTo ( string $output_path ) Allow setting of the output path location
setAutoload ( array $config ) : self Set up any autoload configuration necessary
setBinFiles ( array $files ) : self Set bin-files list
setBranchAlias ( $aliases ) : self Set up any branch-alias that may be specified
setDependencyMap ( array $map ) : self Set a name mapping to dependencies. Naming conventions can vary between PEAR-style and composer/github style.
setExtra ( $extra ) : self Set the entire 'extra' array
setExtraSuggestions ( array $suggestions ) : self Set extra suggestions for features, beyond what is mentioned in package.xml
setHomepage ( string $homepage ) : self Set homepage to use in composer.json. Defaults to channel if not set.
setIncludePath ( array $list ) : self If you must, set up any include paths, relative to vendor dir
setKeywords ( array $keywords ) : self Set keywords which will be picked up by Packagist and/or other package search tools.
setLicense ( $license ) : self Set SPDX license string. If omitted, license value from package.xml will be used.
setName ( string $name ) : self Set the name of the package to put in composer.json
setRepositories ( $repos ) * Horde
setSupportInfo ( $support ) : self Set keywords which will be picked up by Packagist and/or other package search tools.
setType ( $type ) : self Set the type of composer package. Defaults to 'library'
writeTimeToComposer ( $bool ) : self Should release date/time information from package.xml be written to composer.json?
writeVersionToComposer ( $bool ) : self Should version information from package.xml be written to composer.json?

Protected Methods

Method Description
applyConfig ( ) Apply values provided in a config JSON file.
getChannelSuggestedAlias ( $channel )
getDepVersionString ( $req )

Method Details

__construct() public method

public __construct ( $package2file, $config = null )

applyConfig() protected method

Recognized values in JSON configuration: keywords license homepage dependency_map support autoload include_path bin Non-composer.json-standard values: dependency_map: dependency_map allows mapping of PEAR package dependencies to their composer equivalents. output_path: Allows setting where composer.json should be written. Default is to write it in the same directory as package.xml
protected applyConfig ( )

convert() public method

public convert ( $output_file = null )

getChannelSuggestedAlias() protected method

protected getChannelSuggestedAlias ( $channel )

getDepVersionString() protected method

protected getDepVersionString ( $req )

getParsedPackageData() public method

Allow retrieval of parsed data structure.
public getParsedPackageData ( ) : array
return array

help() public static method

Help output for CLI version
public static help ( )

main() public static method

Main method that starts conversion from the command-line
public static main ( )

outputTo() public method

Allow setting of the output path location
public outputTo ( string $output_path )
$output_path string The DIRECTORY to write composer.json into

setAutoload() public method

Set up any autoload configuration necessary
public setAutoload ( array $config ) : self
$config array
return self

setBinFiles() public method

Set bin-files list
public setBinFiles ( array $files ) : self
$files array
return self

setBranchAlias() public method

Set up any branch-alias that may be specified
public setBranchAlias ( $aliases ) : self
return self

setDependencyMap() public method

Set a name mapping to dependencies. Naming conventions can vary between PEAR-style and composer/github style.
public setDependencyMap ( array $map ) : self
$map array
return self

setExtra() public method

Set the entire 'extra' array
See also: http://getcomposer.org/doc/04-schema.md#extra
public setExtra ( $extra ) : self
return self

setExtraSuggestions() public method

Set extra suggestions for features, beyond what is mentioned in package.xml
public setExtraSuggestions ( array $suggestions ) : self
$suggestions array
return self

setHomepage() public method

package search tools.
public setHomepage ( string $homepage ) : self
$homepage string
return self

setIncludePath() public method

If you must, set up any include paths, relative to vendor dir
public setIncludePath ( array $list ) : self
$list array of paths
return self

setKeywords() public method

Set keywords which will be picked up by Packagist and/or other package search tools.
public setKeywords ( array $keywords ) : self
$keywords array
return self

setLicense() public method

Set SPDX license string. If omitted, license value from package.xml will be used.
See also: http://www.spdx.org/licenses/
public setLicense ( $license ) : self
return self

setName() public method

If not set, the channel suggestedalias will be combined with lowercase package name.
public setName ( string $name ) : self
$name string
return self

setRepositories() public method

* Horde
public setRepositories ( $repos )

setSupportInfo() public method

Set keywords which will be picked up by Packagist and/or other package search tools.
public setSupportInfo ( $support ) : self
return self

setType() public method

Set the type of composer package. Defaults to 'library'
public setType ( $type ) : self
return self

writeTimeToComposer() public method

Should release date/time information from package.xml be written to composer.json?
public writeTimeToComposer ( $bool ) : self
return self

writeVersionToComposer() public method

Should version information from package.xml be written to composer.json?
public writeVersionToComposer ( $bool ) : self
return self

Property Details

$autoload protected_oe property

protected $autoload

$bin_files protected_oe property

protected $bin_files

$branch_alias protected_oe property

protected $branch_alias

$config protected_oe property

protected $config

$data protected_oe property

protected $data

$dependency_map protected_oe property

protected $dependency_map

$extra protected_oe property

protected $extra

$extra_suggestions protected_oe property

protected $extra_suggestions

$homepage protected_oe property

protected $homepage

$include_path protected_oe property

protected $include_path

$keywords protected_oe property

protected $keywords

$license protected_oe property

protected $license

$name protected_oe property

protected $name

$output_file public_oe property

public $output_file

$package2file_path protected_oe property

protected $package2file_path

$repositories protected_oe property

* Horde
protected $repositories

$support protected_oe property

protected $support

$type protected_oe property

protected $type

$write_time_to_composer protected_oe property

protected $write_time_to_composer

$write_version_to_composer protected_oe property

protected $write_version_to_composer

$xml protected_oe property

protected $xml