Composer API
Interface

Composer\Package\PackageInterface

interface PackageInterface

Defines the essential information a package has that is used during solving/installation

Methods

string getName()

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

string getPrettyName()

Returns the package's pretty (i.e.

array getNames()

Returns a set of names that could refer to this package

setId(int $id)

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

int getId()

Retrieves the package's id set through setId

bool isDev()

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

string getType()

Returns the package type, e.g.

string getTargetDir()

Returns the package targetDir property

array getExtra()

Returns the package extra data

setInstallationSource(string $type)

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

string getInstallationSource()

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

string getSourceType()

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

string getSourceUrl()

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

array getSourceUrls()

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

string getSourceReference()

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

array|null getSourceMirrors()

Returns the source mirrors of this package

string getDistType()

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

string getDistUrl()

Returns the url of the distribution archive of this version

array getDistUrls()

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

string getDistReference()

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

string getDistSha1Checksum()

Returns the sha1 checksum for the distribution archive of this version

array|null getDistMirrors()

Returns the dist mirrors of this package

string getVersion()

Returns the version of this package

string getPrettyVersion()

Returns the pretty (i.e.

string getFullPrettyVersion(bool $truncate = true)

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

DateTime getReleaseDate()

Returns the release date of the package

string getStability()

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

Link[] getRequires()

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

Link[] getConflicts()

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

Link[] getProvides()

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

Link[] getReplaces()

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

Link[] getDevRequires()

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

array getSuggests()

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

array getAutoload()

Returns an associative array of autoloading rules

array getDevAutoload()

Returns an associative array of dev autoloading rules

array getIncludePaths()

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

setRepository(RepositoryInterface $repository)

Stores a reference to the repository that owns the package

RepositoryInterface getRepository()

Returns a reference to the repository that owns the package

array getBinaries()

Returns the package binaries

string getUniqueName()

Returns package unique name, constructed from name and version.

string getNotificationUrl()

Returns the package notification url

string __toString()

Converts the package into a readable and unique string

string getPrettyString()

Converts the package into a pretty readable string

array getArchiveExcludes()

Returns a list of patterns to exclude from package archives

array getTransportOptions()

Returns a list of options to download package dist files

Details

at line 29
public string getName()

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

Return Value

string package name

at line 36
public string getPrettyName()

Returns the package's pretty (i.e.

with proper case) name

Return Value

string package name

at line 46
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

at line 53
public setId(int $id)

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

Parameters

int $id

at line 60
public int getId()

Retrieves the package's id set through setId

Return Value

int The previously set package id

at line 67
public bool isDev()

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

Return Value

bool

at line 74
public string getType()

Returns the package type, e.g.

library

Return Value

string The package type

at line 81
public string getTargetDir()

Returns the package targetDir property

Return Value

string The package targetDir

at line 88
public array getExtra()

Returns the package extra data

Return Value

array The package extra data

at line 95
public setInstallationSource(string $type)

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

Parameters

string $type source/dist

at line 102
public string getInstallationSource()

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

Return Value

string source/dist

at line 109
public string getSourceType()

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

git, svn

Return Value

string The repository type

at line 116
public string getSourceUrl()

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

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

Return Value

string The repository url

at line 123
public array getSourceUrls()

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

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

Return Value

array

at line 130
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

at line 137
public array|null getSourceMirrors()

Returns the source mirrors of this package

Return Value

array|null

at line 144
public string getDistType()

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

zip, tarball

Return Value

string The repository type

at line 151
public string getDistUrl()

Returns the url of the distribution archive of this version

Return Value

string

at line 158
public array getDistUrls()

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

Return Value

array

at line 165
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

at line 172
public string getDistSha1Checksum()

Returns the sha1 checksum for the distribution archive of this version

Return Value

string

at line 179
public array|null getDistMirrors()

Returns the dist mirrors of this package

Return Value

array|null

at line 186
public string getVersion()

Returns the version of this package

Return Value

string version

at line 193
public string getPrettyVersion()

Returns the pretty (i.e.

non-normalized) version string of this package

Return Value

string version

at line 203
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

See also

getPrettyVersion

at line 210
public DateTime getReleaseDate()

Returns the release date of the package

Return Value

DateTime

at line 217
public string getStability()

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

Return Value

string

at line 225
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

at line 233
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

at line 241
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

at line 249
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

at line 257
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

at line 265
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

at line 277
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

at line 289
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

at line 297
public array getIncludePaths()

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

Return Value

array

at line 304
public setRepository(RepositoryInterface $repository)

Stores a reference to the repository that owns the package

Parameters

RepositoryInterface $repository

at line 311
public RepositoryInterface getRepository()

Returns a reference to the repository that owns the package

Return Value

RepositoryInterface

at line 318
public array getBinaries()

Returns the package binaries

Return Value

array

at line 325
public string getUniqueName()

Returns package unique name, constructed from name and version.

Return Value

string

at line 332
public string getNotificationUrl()

Returns the package notification url

Return Value

string

at line 339
public string __toString()

Converts the package into a readable and unique string

Return Value

string

at line 346
public string getPrettyString()

Converts the package into a pretty readable string

Return Value

string

at line 353
public array getArchiveExcludes()

Returns a list of patterns to exclude from package archives

Return Value

array

at line 360
public array getTransportOptions()

Returns a list of options to download package dist files

Return Value

array