Composer API
Class

Composer\Repository\WritableArrayRepository

class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface

Writable array repository.

Methods

__construct(array $packages = array())

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

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

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

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

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

Searches the repository for packages containing the query

from ArrayRepository
bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

from ArrayRepository
addPackage(PackageInterface $package)

Adds a new package to the repository

from ArrayRepository
removePackage(PackageInterface $package)

Removes package from repository.

from ArrayRepository
array getPackages()

Returns list of registered packages.

from ArrayRepository
int count()

Returns the number of packages in this repository

from ArrayRepository
write()

Writes repository (f.e.

reload()

Forces a reload of all packages.

PackageInterface[] getCanonicalPackages()

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

Details

in ArrayRepository at line 32
public __construct(array $packages = array())

Parameters

array $packages

in ArrayRepository at line 42
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 ArrayRepository at line 64
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

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

in ArrayRepository at line 116
public bool hasPackage(PackageInterface $package)

Checks if specified package registered (installed).

Parameters

PackageInterface $package package instance

Return Value

bool

in ArrayRepository at line 134
public addPackage(PackageInterface $package)

Adds a new package to the repository

Parameters

PackageInterface $package

in ArrayRepository at line 160
public removePackage(PackageInterface $package)

Removes package from repository.

Parameters

PackageInterface $package package instance

in ArrayRepository at line 176
public array getPackages()

Returns list of registered packages.

Return Value

array

in ArrayRepository at line 190
public int count()

Returns the number of packages in this repository

Return Value

int Number of packages

at line 27
public write()

Writes repository (f.e.

to the disc).

at line 34
public reload()

Forces a reload of all packages.

at line 41
public PackageInterface[] getCanonicalPackages()

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

Return Value

PackageInterface[]