\Composer\RepositoryWritableRepositoryInterface

Writable repository interface.

Summary

Methods
Constants
hasPackage()
findPackage()
findPackages()
getPackages()
search()
write()
addPackage()
removePackage()
getCanonicalPackages()
reload()
SEARCH_FULLTEXT
SEARCH_NAME
No protected methods found
N/A
No private methods found
N/A

Methods

hasPackage()

hasPackage(\Composer\Package\PackageInterface  $package) : boolean

Checks if specified package registered (installed).

Parameters

\Composer\Package\PackageInterface $package

package instance

Returns

boolean

findPackage()

findPackage(string  $name, string|\Composer\Semver\Constraint\ConstraintInterface  $constraint) : \Composer\Package\PackageInterface|null

Searches for the first match of a package by name and version.

Parameters

string $name

package name

string|\Composer\Semver\Constraint\ConstraintInterface $constraint

package version or version constraint to match against

Returns

\Composer\Package\PackageInterface|null

findPackages()

findPackages(string  $name, string|\Composer\Semver\Constraint\ConstraintInterface  $constraint = null) : array<mixed,\Composer\Package\PackageInterface>

Searches for all packages matching a name and optionally a version.

Parameters

string $name

package name

string|\Composer\Semver\Constraint\ConstraintInterface $constraint

package version or version constraint to match against

Returns

array<mixed,\Composer\Package\PackageInterface>

getPackages()

getPackages() : array<mixed,\Composer\Package\PackageInterface>

Returns list of registered packages.

Returns

array<mixed,\Composer\Package\PackageInterface>

search()

search(string  $query, integer  $mode) : array<mixed,array>

Searches the repository for packages containing the query

Parameters

string $query

search query

integer $mode

a set of SEARCH_* constants to search on, implementations should do a best effort only

Returns

array<mixed,array> —

an array of array('name' => '...', 'description' => '...')

write()

write() 

Writes repository (f.e. to the disc).

addPackage()

addPackage(\Composer\Package\PackageInterface  $package) 

Adds package to the repository.

Parameters

\Composer\Package\PackageInterface $package

package instance

removePackage()

removePackage(\Composer\Package\PackageInterface  $package) 

Removes package from the repository.

Parameters

\Composer\Package\PackageInterface $package

package instance

getCanonicalPackages()

getCanonicalPackages() : array<mixed,\Composer\Package\PackageInterface>

Get unique packages (at most one package of each name), with aliases resolved and removed.

Returns

array<mixed,\Composer\Package\PackageInterface>

reload()

reload() 

Forces a reload of all packages.