class RepositoryManager (View source)

Repositories manager.

Methods

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

No description

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

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.

getLocalRepository()

Returns local repository for the project.

Details

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

Parameters

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

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

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

addRepository(RepositoryInterface $repository)

Adds repository

Parameters

RepositoryInterface $repository repository instance

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

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

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

array getRepositories()

Returns all repositories, except local one.

Return Value

array

setLocalRepository(WritableRepositoryInterface $repository)

Sets local repository for the project.

Parameters

WritableRepositoryInterface $repository repository instance

WritableRepositoryInterface getLocalRepository()

Returns local repository for the project.