Composer API
Interface

Composer\Repository\WritableRepositoryInterface

interface WritableRepositoryInterface implements RepositoryInterface

Writable repository interface.

Methods

bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

from RepositoryInterface
PackageInterface|null findPackage(string $name, string|LinkConstraintInterface $constraint)

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

from RepositoryInterface
array findPackages(string $name, string|LinkConstraintInterface $constraint = null)

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

from RepositoryInterface
array getPackages()

Returns list of registered packages.

from RepositoryInterface
array[] search(string $query, int $mode)

Searches the repository for packages containing the query

from RepositoryInterface
write()

Writes repository (f.e.

addPackage(PackageInterface $package)

Adds package to the repository.

removePackage(PackageInterface $package)

Removes package from the repository.

PackageInterface[] getCanonicalPackages()

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

reload()

Forces a reload of all packages.

Details

in RepositoryInterface at line 36
public bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

Parameters

PackageInterface $package package instance

Return Value

bool

in RepositoryInterface at line 46
public PackageInterface|null findPackage(string $name, string|LinkConstraintInterface $constraint)

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

Parameters

string $name package name
string|LinkConstraintInterface $constraint package version or version constraint to match against

Return Value

PackageInterface|null

in RepositoryInterface at line 56
public array findPackages(string $name, string|LinkConstraintInterface $constraint = null)

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

Parameters

string $name package name
string|LinkConstraintInterface $constraint package version or version constraint to match against

Return Value

array

in RepositoryInterface at line 63
public array getPackages()

Returns list of registered packages.

Return Value

array

Searches the repository for packages containing the query

Parameters

string $query search query
int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only

Return Value

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

at line 27
public write()

Writes repository (f.e.

to the disc).

at line 34
public addPackage(PackageInterface $package)

Adds package to the repository.

Parameters

PackageInterface $package package instance

at line 41
public removePackage(PackageInterface $package)

Removes package from the repository.

Parameters

PackageInterface $package package instance

at line 48
public PackageInterface[] getCanonicalPackages()

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

Return Value

PackageInterface[]

at line 53
public reload()

Forces a reload of all packages.