Composer API
Class

Composer\Repository\CompositeRepository

class CompositeRepository extends BaseRepository

Composite repository.

Methods

array getDependents(string|string[] $needle, ConstraintInterface|null $constraint = null, bool $invert = false, bool $recurse = true, string[] $packagesFound = null)

Returns a list of links causing the requested needle packages to be installed, as an associative array with the dependent's name as key, and an array containing in order the PackageInterface and Link describing the relationship as values.

from BaseRepository
__construct(array $repositories)

Constructor

array getRepositories()

Returns all the wrapped repositories

bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

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

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

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

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

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

Searches the repository for packages containing the query

PackageInterface[] getPackages()

Returns list of registered packages.

removePackage(PackageInterface $package)

{@inheritdoc}

count()

{@inheritdoc}

addRepository(RepositoryInterface $repository)

Add a repository.

Details

in BaseRepository at line 40
public array getDependents(string|string[] $needle, ConstraintInterface|null $constraint = null, bool $invert = false, bool $recurse = true, string[] $packagesFound = null)

Returns a list of links causing the requested needle packages to be installed, as an associative array with the dependent's name as key, and an array containing in order the PackageInterface and Link describing the relationship as values.

If recursive lookup was requested a third value is returned containing an identically formed array up to the root package. That third value will be false in case a circular recursion was detected.

Parameters

string|string[] $needle The package name(s) to inspect.
ConstraintInterface|null $constraint Optional constraint to filter by.
bool $invert Whether to invert matches to discover reasons for the package NOT to be installed.
bool $recurse Whether to recursively expand the requirement tree up to the root package.
string[] $packagesFound Used internally when recurring

Return Value

array An associative array of arrays as described above.

at line 34
public __construct(array $repositories)

Constructor

Parameters

array $repositories

at line 47
public array getRepositories()

Returns all the wrapped repositories

Return Value

array

at line 55
public bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

Parameters

PackageInterface $package package instance

Return Value

bool

at line 70
public 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

at line 86
public 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[]

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
string $type The type of package to search for. Defaults to all types of packages

Return Value

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

at line 114
public PackageInterface[] getPackages()

Returns list of registered packages.

Return Value

PackageInterface[]

at line 128
public removePackage(PackageInterface $package)

{@inheritdoc}

Parameters

PackageInterface $package

at line 139
public count()

{@inheritdoc}

at line 154
public addRepository(RepositoryInterface $repository)

Add a repository.

Parameters

RepositoryInterface $repository