Composer API
Class

Composer\Repository\RepositoryManager

class RepositoryManager

Repositories manager.

Methods

__construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)

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

Searches for a package by it's name and version in managed repositories.

array findPackages(string $name, string|ConstraintInterface $constraint)

Searches for all packages matching a name and optionally a version in managed repositories.

addRepository(RepositoryInterface $repository)

Adds repository

prependRepository(RepositoryInterface $repository)

Adds a repository to the beginning of the chain

RepositoryInterface createRepository(string $type, array $config, string $name = null)

Returns a new repository for a specific installation type.

setRepositoryClass(string $type, string $class)

Stores repository class for a specific installation type.

array getRepositories()

Returns all repositories, except local one.

setLocalRepository(WritableRepositoryInterface $repository)

Sets local repository for the project.

WritableRepositoryInterface getLocalRepository()

Returns local repository for the project.

Details

at line 38
public __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)

Parameters

IOInterface $io
Config $config
EventDispatcher $eventDispatcher
RemoteFilesystem $rfs

at line 54
public PackageInterface|null findPackage(string $name, string|ConstraintInterface $constraint)

Searches for a package by it's name and version in managed repositories.

Parameters

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

Return Value

PackageInterface|null

at line 73
public array findPackages(string $name, string|ConstraintInterface $constraint)

Searches for all packages matching a name and optionally a version in managed repositories.

Parameters

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

Return Value

array

at line 89
public addRepository(RepositoryInterface $repository)

Adds repository

Parameters

RepositoryInterface $repository repository instance

at line 101
public prependRepository(RepositoryInterface $repository)

Adds a repository to the beginning of the chain

This is useful when injecting additional repositories that should trump Packagist, e.g. from a plugin.

Parameters

RepositoryInterface $repository repository instance

at line 115
public RepositoryInterface createRepository(string $type, array $config, string $name = null)

Returns a new repository for a specific installation type.

Parameters

string $type repository type
array $config repository configuration
string $name repository name

Return Value

RepositoryInterface

Exceptions

InvalidArgumentException if repository for provided type is not registered

at line 142
public setRepositoryClass(string $type, string $class)

Stores repository class for a specific installation type.

Parameters

string $type installation type
string $class class name of the repo implementation

at line 152
public array getRepositories()

Returns all repositories, except local one.

Return Value

array

at line 162
public setLocalRepository(WritableRepositoryInterface $repository)

Sets local repository for the project.

Parameters

WritableRepositoryInterface $repository repository instance

at line 172
public WritableRepositoryInterface getLocalRepository()

Returns local repository for the project.