interface WritableRepositoryInterface implements RepositoryInterface (View source)

Writable repository interface.

Methods

bool
hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

findPackage(string $name, string|ConstraintInterface $constraint)

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

findPackages(string $name, string|ConstraintInterface $constraint = null)

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

getPackages()

Returns list of registered packages.

array[]
search(string $query, int $mode = 0)

Searches the repository for packages containing the query

write()

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

addPackage(PackageInterface $package)

Adds package to the repository.

removePackage(PackageInterface $package)

Removes package from the repository.

getCanonicalPackages()

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

reload()

Forces a reload of all packages.

Details

bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

Parameters

PackageInterface $package package instance

Return Value

bool

PackageInterface|null findPackage(string $name, string|ConstraintInterface $constraint)

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

Parameters

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

Return Value

PackageInterface|null

PackageInterface[] findPackages(string $name, string|ConstraintInterface $constraint = null)

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

Parameters

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

Return Value

PackageInterface[]

PackageInterface[] getPackages()

Returns list of registered packages.

Return Value

PackageInterface[]

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' => '...')

write()

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

addPackage(PackageInterface $package)

Adds package to the repository.

Parameters

PackageInterface $package package instance

removePackage(PackageInterface $package)

Removes package from the repository.

Parameters

PackageInterface $package package instance

PackageInterface[] getCanonicalPackages()

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

Return Value

PackageInterface[]

reload()

Forces a reload of all packages.