Composer API
Class

Composer\Package\RootPackage

class RootPackage extends CompletePackage implements RootPackageInterface

The root package represents the project's composer.json and contains additional metadata

Constants

STABILITY_STABLE

STABILITY_RC

STABILITY_BETA

STABILITY_ALPHA

STABILITY_DEV

Properties

static $supportedLinkTypes
static $stabilities
int $id READ-ONLY: The package id, public for fast access in dependency solver

Methods

__construct(string $name, string $version, string $prettyVersion)

All descendants' constructors should call this parent constructor

from Package
string getName()

Returns the package's name without version info, thus not a unique identifier

from BasePackage
string getPrettyName()

Returns the package's pretty (i.e.

from BasePackage
array getNames()

Returns a set of names that could refer to this package

from BasePackage
setId(int $id)

Allows the solver to set an id for this package to refer to it.

from BasePackage
int getId()

Retrieves the package's id set through setId

from BasePackage
setRepository(RepositoryInterface $repository)

Stores a reference to the repository that owns the package

from BasePackage
RepositoryInterface getRepository()

Returns a reference to the repository that owns the package

from BasePackage
array getTransportOptions()

Returns a list of options to download package dist files

from BasePackage
setTransportOptions(array $options)

Configures the list of options to download package dist files

from BasePackage
bool isPlatform()

checks if this package is a platform package

from BasePackage
string getUniqueName()

Returns package unique name, constructed from name and version.

from BasePackage
equals(PackageInterface $package)

from BasePackage
string __toString()

Converts the package into a readable and unique string

from BasePackage
string getPrettyString()

Converts the package into a pretty readable string

from BasePackage
string getFullPrettyVersion(bool $truncate = true)

Returns the pretty version string plus a git or hg commit hash of this package

from BasePackage
getStabilityPriority()

from BasePackage
__clone()

from BasePackage
bool isDev()

Returns whether the package is a development virtual package or a concrete one

from Package
setType(string $type)

from Package
string getType()

Returns the package type, e.g.

from Package
string getStability()

Returns the stability of this package: one of (dev, alpha, beta, RC, stable)

from Package
setTargetDir(string $targetDir)

from Package
string getTargetDir()

Returns the package targetDir property

from Package
setExtra(array $extra)

from Package
array getExtra()

Returns the package extra data

from Package
setBinaries(array $binaries)

from Package
array getBinaries()

Returns the package binaries

from Package
setInstallationSource(string $type)

Sets source from which this package was installed (source/dist).

from Package
string getInstallationSource()

Returns source from which this package was installed (source/dist).

from Package
setSourceType(string $type)

from Package
string getSourceType()

Returns the repository type of this package, e.g.

from Package
setSourceUrl(string $url)

from Package
string getSourceUrl()

Returns the repository url of this package, e.g.

from Package
setSourceReference(string $reference)

from Package
string getSourceReference()

Returns the repository reference of this package, e.g.

from Package
setSourceMirrors(array|null $mirrors)

from Package
array|null getSourceMirrors()

Returns the source mirrors of this package

from Package
array getSourceUrls()

Returns the repository urls of this package including mirrors, e.g.

from Package
setDistType(string $type)

from Package
string getDistType()

Returns the type of the distribution archive of this version, e.g.

from Package
setDistUrl(string $url)

from Package
string getDistUrl()

Returns the url of the distribution archive of this version

from Package
setDistReference(string $reference)

from Package
string getDistReference()

Returns the reference of the distribution archive of this version, e.g.

from Package
setDistSha1Checksum(string $sha1checksum)

from Package
string getDistSha1Checksum()

Returns the sha1 checksum for the distribution archive of this version

from Package
setDistMirrors(array|null $mirrors)

from Package
array|null getDistMirrors()

Returns the dist mirrors of this package

from Package
array getDistUrls()

Returns the urls of the distribution archive of this version, including mirrors

from Package
string getVersion()

Returns the version of this package

from Package
string getPrettyVersion()

Returns the pretty (i.e.

from Package
setReleaseDate(DateTime $releaseDate)

Set the releaseDate

from Package
DateTime getReleaseDate()

Returns the release date of the package

from Package
setRequires(array $requires)

Set the required packages

from Package
Link[] getRequires()

Returns a set of links to packages which need to be installed before this package can be installed

from Package
setConflicts(array $conflicts)

Set the conflicting packages

from Package
Link[] getConflicts()

Returns a set of links to packages which must not be installed at the same time as this package

from Package
setProvides(array $provides)

Set the provided virtual packages

from Package
Link[] getProvides()

Returns a set of links to virtual packages that are provided through this package

from Package
setReplaces(array $replaces)

Set the packages this one replaces

from Package
Link[] getReplaces()

Returns a set of links to packages which can alternatively be satisfied by installing this package

from Package
setDevRequires(array $devRequires)

Set the recommended packages

from Package
Link[] getDevRequires()

Returns a set of links to packages which are required to develop this package.

from Package
setSuggests(array $suggests)

Set the suggested packages

from Package
array getSuggests()

Returns a set of package names and reasons why they are useful in combination with this package.

from Package
setAutoload(array $autoload)

Set the autoload mapping

from Package
array getAutoload()

Returns an associative array of autoloading rules

from Package
setDevAutoload(array $devAutoload)

Set the dev autoload mapping

from Package
array getDevAutoload()

Returns an associative array of dev autoloading rules

from Package
setIncludePaths(array $includePaths)

Sets the list of paths added to PHP's include path.

from Package
array getIncludePaths()

Returns a list of directories which should get added to PHP's include path.

from Package
setNotificationUrl(string $notificationUrl)

Sets the notification URL

from Package
string getNotificationUrl()

Returns the package notification url

from Package
setArchiveExcludes(array $excludes)

Sets a list of patterns to be excluded from archives

from Package
array getArchiveExcludes()

Returns a list of patterns to exclude from package archives

from Package
replaceVersion(string $version, string $prettyVersion)

Replaces current version and pretty version with passed values.

from Package
setScripts(array $scripts)

from CompletePackage
array getScripts()

Returns the scripts of this package

from CompletePackage
setRepositories(array $repositories)

Set the repositories

from CompletePackage
array getRepositories()

Returns an array of repositories

from CompletePackage
setLicense(array $license)

Set the license

from CompletePackage
array getLicense()

Returns the package license, e.g.

from CompletePackage
setKeywords(array $keywords)

Set the keywords

from CompletePackage
array getKeywords()

Returns an array of keywords relating to the package

from CompletePackage
setAuthors(array $authors)

Set the authors

from CompletePackage
array getAuthors()

Returns an array of authors of the package

from CompletePackage
setDescription(string $description)

Set the description

from CompletePackage
string getDescription()

Returns the package description

from CompletePackage
setHomepage(string $homepage)

Set the homepage

from CompletePackage
string getHomepage()

Returns the package homepage

from CompletePackage
setSupport(array $support)

Set the support information

from CompletePackage
array getSupport()

Returns the support information

from CompletePackage
bool isAbandoned()

Returns if the package is abandoned or not

from CompletePackage
setAbandoned(bool|string $abandoned)

from CompletePackage
string|null getReplacementPackage()

If the package is abandoned and has a suggested replacement, this method returns it

from CompletePackage
setMinimumStability(string $minimumStability)

Set the minimumStability

string getMinimumStability()

Returns the minimum stability of the package

setStabilityFlags(array $stabilityFlags)

Set the stabilityFlags

array getStabilityFlags()

Returns the stability flags to apply to dependencies

setPreferStable(bool $preferStable)

Set the preferStable

bool getPreferStable()

Returns true if the root package prefers picking stable packages over unstable ones

setConfig(array $config)

Set the config

array getConfig()

Returns the root package's configuration

setReferences(array $references)

Set the references

array getReferences()

Returns a set of package names and source references that must be enforced on them

setAliases(array $aliases)

Set the aliases

array getAliases()

Returns a set of package names and their aliases

Details

in Package at line 69
public __construct(string $name, string $version, string $prettyVersion)

All descendants' constructors should call this parent constructor

Parameters

string $name The package's name
string $version The package's version
string $prettyVersion The package's non-normalized version

in BasePackage at line 75
public string getName()

Returns the package's name without version info, thus not a unique identifier

Return Value

string package name

in BasePackage at line 83
public string getPrettyName()

Returns the package's pretty (i.e.

with proper case) name

Return Value

string package name

in BasePackage at line 91
public array getNames()

Returns a set of names that could refer to this package

No version or release type information should be included in any of the names. Provided or replaced package names need to be returned as well.

Return Value

array An array of strings referring to this package

in BasePackage at line 111
public setId(int $id)

Allows the solver to set an id for this package to refer to it.

Parameters

int $id

in BasePackage at line 119
public int getId()

Retrieves the package's id set through setId

Return Value

int The previously set package id

in BasePackage at line 127
public setRepository(RepositoryInterface $repository)

Stores a reference to the repository that owns the package

Parameters

RepositoryInterface $repository

in BasePackage at line 138
public RepositoryInterface getRepository()

Returns a reference to the repository that owns the package

Return Value

RepositoryInterface

in BasePackage at line 146
public array getTransportOptions()

Returns a list of options to download package dist files

Return Value

array

in BasePackage at line 156
public setTransportOptions(array $options)

Configures the list of options to download package dist files

Parameters

array $options

in BasePackage at line 166
public bool isPlatform()

checks if this package is a platform package

Return Value

bool

in BasePackage at line 176
public string getUniqueName()

Returns package unique name, constructed from name and version.

Return Value

string

in BasePackage at line 181
public equals(PackageInterface $package)

Parameters

PackageInterface $package

in BasePackage at line 199
public string __toString()

Converts the package into a readable and unique string

Return Value

string

in BasePackage at line 204
public string getPrettyString()

Converts the package into a pretty readable string

Return Value

string

in BasePackage at line 212
public string getFullPrettyVersion(bool $truncate = true)

Returns the pretty version string plus a git or hg commit hash of this package

Parameters

bool $truncate If the source reference is a sha1 hash, truncate it

Return Value

string version

in BasePackage at line 226
public getStabilityPriority()

in BasePackage at line 231
public __clone()

in Package at line 83
public bool isDev()

Returns whether the package is a development virtual package or a concrete one

Return Value

bool

in Package at line 91
public setType(string $type)

Parameters

string $type

in Package at line 99
public string getType()

Returns the package type, e.g.

library

Return Value

string The package type

in Package at line 107
public string getStability()

Returns the stability of this package: one of (dev, alpha, beta, RC, stable)

Return Value

string

in Package at line 115
public setTargetDir(string $targetDir)

Parameters

string $targetDir

in Package at line 123
public string getTargetDir()

Returns the package targetDir property

Return Value

string The package targetDir

in Package at line 135
public setExtra(array $extra)

Parameters

array $extra

in Package at line 143
public array getExtra()

Returns the package extra data

Return Value

array The package extra data

in Package at line 151
public setBinaries(array $binaries)

Parameters

array $binaries

in Package at line 159
public array getBinaries()

Returns the package binaries

Return Value

array

in Package at line 167
public setInstallationSource(string $type)

Sets source from which this package was installed (source/dist).

Parameters

string $type source/dist

in Package at line 175
public string getInstallationSource()

Returns source from which this package was installed (source/dist).

Return Value

string source/dist

in Package at line 183
public setSourceType(string $type)

Parameters

string $type

in Package at line 191
public string getSourceType()

Returns the repository type of this package, e.g.

git, svn

Return Value

string The repository type

in Package at line 199
public setSourceUrl(string $url)

Parameters

string $url

in Package at line 207
public string getSourceUrl()

Returns the repository url of this package, e.g.

git://github.com/naderman/composer.git

Return Value

string The repository url

in Package at line 215
public setSourceReference(string $reference)

Parameters

string $reference

in Package at line 223
public string getSourceReference()

Returns the repository reference of this package, e.g.

master, 1.0.0 or a commit hash for git

Return Value

string The repository reference

in Package at line 231
public setSourceMirrors(array|null $mirrors)

Parameters

array|null $mirrors

in Package at line 239
public array|null getSourceMirrors()

Returns the source mirrors of this package

Return Value

array|null

in Package at line 247
public array getSourceUrls()

Returns the repository urls of this package including mirrors, e.g.

git://github.com/naderman/composer.git

Return Value

array

in Package at line 255
public setDistType(string $type)

Parameters

string $type

in Package at line 263
public string getDistType()

Returns the type of the distribution archive of this version, e.g.

zip, tarball

Return Value

string The repository type

in Package at line 271
public setDistUrl(string $url)

Parameters

string $url

in Package at line 279
public string getDistUrl()

Returns the url of the distribution archive of this version

Return Value

string

in Package at line 287
public setDistReference(string $reference)

Parameters

string $reference

in Package at line 295
public string getDistReference()

Returns the reference of the distribution archive of this version, e.g.

master, 1.0.0 or a commit hash for git

Return Value

string

in Package at line 303
public setDistSha1Checksum(string $sha1checksum)

Parameters

string $sha1checksum

in Package at line 311
public string getDistSha1Checksum()

Returns the sha1 checksum for the distribution archive of this version

Return Value

string

in Package at line 319
public setDistMirrors(array|null $mirrors)

Parameters

array|null $mirrors

in Package at line 327
public array|null getDistMirrors()

Returns the dist mirrors of this package

Return Value

array|null

in Package at line 335
public array getDistUrls()

Returns the urls of the distribution archive of this version, including mirrors

Return Value

array

in Package at line 343
public string getVersion()

Returns the version of this package

Return Value

string version

in Package at line 351
public string getPrettyVersion()

Returns the pretty (i.e.

non-normalized) version string of this package

Return Value

string version

in Package at line 361
public setReleaseDate(DateTime $releaseDate)

Set the releaseDate

Parameters

DateTime $releaseDate

in Package at line 369
public DateTime getReleaseDate()

Returns the release date of the package

Return Value

DateTime

in Package at line 379
public setRequires(array $requires)

Set the required packages

Parameters

array $requires A set of package links

in Package at line 387
public Link[] getRequires()

Returns a set of links to packages which need to be installed before this package can be installed

Return Value

Link[] An array of package links defining required packages

in Package at line 397
public setConflicts(array $conflicts)

Set the conflicting packages

Parameters

array $conflicts A set of package links

in Package at line 405
public Link[] getConflicts()

Returns a set of links to packages which must not be installed at the same time as this package

Return Value

Link[] An array of package links defining conflicting packages

in Package at line 415
public setProvides(array $provides)

Set the provided virtual packages

Parameters

array $provides A set of package links

in Package at line 423
public Link[] getProvides()

Returns a set of links to virtual packages that are provided through this package

Return Value

Link[] An array of package links defining provided packages

in Package at line 433
public setReplaces(array $replaces)

Set the packages this one replaces

Parameters

array $replaces A set of package links

in Package at line 441
public Link[] getReplaces()

Returns a set of links to packages which can alternatively be satisfied by installing this package

Return Value

Link[] An array of package links defining replaced packages

in Package at line 451
public setDevRequires(array $devRequires)

Set the recommended packages

Parameters

array $devRequires A set of package links

in Package at line 459
public Link[] getDevRequires()

Returns a set of links to packages which are required to develop this package.

These are installed if in dev mode.

Return Value

Link[] An array of package links defining packages required for development

in Package at line 469
public setSuggests(array $suggests)

Set the suggested packages

Parameters

array $suggests A set of package names/comments

in Package at line 477
public array getSuggests()

Returns a set of package names and reasons why they are useful in combination with this package.

Return Value

array An array of package suggestions with descriptions

in Package at line 487
public setAutoload(array $autoload)

Set the autoload mapping

Parameters

array $autoload Mapping of autoloading rules

in Package at line 495
public array getAutoload()

Returns an associative array of autoloading rules

{"": {"<namespace": ""}}

Type is either "psr-4", "psr-0", "classmap" or "files". Namespaces are mapped to directories for autoloading using the type specified.

Return Value

array Mapping of autoloading rules

in Package at line 505
public setDevAutoload(array $devAutoload)

Set the dev autoload mapping

Parameters

array $devAutoload Mapping of dev autoloading rules

in Package at line 513
public array getDevAutoload()

Returns an associative array of dev autoloading rules

{"": {"<namespace": ""}}

Type is either "psr-4", "psr-0", "classmap" or "files". Namespaces are mapped to directories for autoloading using the type specified.

Return Value

array Mapping of dev autoloading rules

in Package at line 523
public setIncludePaths(array $includePaths)

Sets the list of paths added to PHP's include path.

Parameters

array $includePaths List of directories.

in Package at line 531
public array getIncludePaths()

Returns a list of directories which should get added to PHP's include path.

Return Value

array

in Package at line 541
public setNotificationUrl(string $notificationUrl)

Sets the notification URL

Parameters

string $notificationUrl

in Package at line 549
public string getNotificationUrl()

Returns the package notification url

Return Value

string

in Package at line 559
public setArchiveExcludes(array $excludes)

Sets a list of patterns to be excluded from archives

Parameters

array $excludes

in Package at line 567
public array getArchiveExcludes()

Returns a list of patterns to exclude from package archives

Return Value

array

in Package at line 579
public replaceVersion(string $version, string $prettyVersion)

Replaces current version and pretty version with passed values.

It also sets stability.

Parameters

string $version The package's normalized version
string $prettyVersion The package's non-normalized version

in CompletePackage at line 35
public setScripts(array $scripts)

Parameters

array $scripts

in CompletePackage at line 43
public array getScripts()

Returns the scripts of this package

Return Value

array array('script name' => array('listeners'))

in CompletePackage at line 53
public setRepositories(array $repositories)

Set the repositories

Parameters

array $repositories

in CompletePackage at line 61
public array getRepositories()

Returns an array of repositories

{"": {}}

Return Value

array Repositories

in CompletePackage at line 71
public setLicense(array $license)

Set the license

Parameters

array $license

in CompletePackage at line 79
public array getLicense()

Returns the package license, e.g.

MIT, BSD, GPL

Return Value

array The package licenses

in CompletePackage at line 89
public setKeywords(array $keywords)

Set the keywords

Parameters

array $keywords

in CompletePackage at line 97
public array getKeywords()

Returns an array of keywords relating to the package

Return Value

array

in CompletePackage at line 107
public setAuthors(array $authors)

Set the authors

Parameters

array $authors

in CompletePackage at line 115
public array getAuthors()

Returns an array of authors of the package

Each item can contain name/homepage/email keys

Return Value

array

in CompletePackage at line 125
public setDescription(string $description)

Set the description

Parameters

string $description

in CompletePackage at line 133
public string getDescription()

Returns the package description

Return Value

string

in CompletePackage at line 143
public setHomepage(string $homepage)

Set the homepage

Parameters

string $homepage

in CompletePackage at line 151
public string getHomepage()

Returns the package homepage

Return Value

string

in CompletePackage at line 161
public setSupport(array $support)

Set the support information

Parameters

array $support

in CompletePackage at line 169
public array getSupport()

Returns the support information

Return Value

array

in CompletePackage at line 177
public bool isAbandoned()

Returns if the package is abandoned or not

Return Value

bool

in CompletePackage at line 185
public setAbandoned(bool|string $abandoned)

Parameters

bool|string $abandoned

in CompletePackage at line 195
public string|null getReplacementPackage()

If the package is abandoned and has a suggested replacement, this method returns it

Return Value

string|null

at line 34
public setMinimumStability(string $minimumStability)

Set the minimumStability

Parameters

string $minimumStability

at line 42
public string getMinimumStability()

Returns the minimum stability of the package

Return Value

string

at line 52
public setStabilityFlags(array $stabilityFlags)

Set the stabilityFlags

Parameters

array $stabilityFlags

at line 60
public array getStabilityFlags()

Returns the stability flags to apply to dependencies

array('foo/bar' => 'dev')

Return Value

array

at line 70
public setPreferStable(bool $preferStable)

Set the preferStable

Parameters

bool $preferStable

at line 78
public bool getPreferStable()

Returns true if the root package prefers picking stable packages over unstable ones

Return Value

bool

at line 88
public setConfig(array $config)

Set the config

Parameters

array $config

at line 96
public array getConfig()

Returns the root package's configuration

Return Value

array

at line 106
public setReferences(array $references)

Set the references

Parameters

array $references

at line 114
public array getReferences()

Returns a set of package names and source references that must be enforced on them

array('foo/bar' => 'abcd1234')

Return Value

array

at line 124
public setAliases(array $aliases)

Set the aliases

Parameters

array $aliases

at line 132
public array getAliases()

Returns a set of package names and their aliases

Return Value

array