class Locker (View source)

Reads/writes project lockfile (composer.lock).

Methods

__construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, string $composerFileContents)

Initializes packages locker.

static string
getContentHash(string $composerFileContents)

Returns the md5 hash of the sorted content of the composer file.

bool
isLocked()

Checks whether locker has been locked (lockfile found).

bool
isFresh()

Checks whether the lock file is still up to date with the current hash

getLockedRepository(bool $withDevReqs = false)

Searches and returns an array of locked packages, retrieved from registered repositories.

Link[]
getPlatformRequirements(bool $withDevReqs = false)

Returns the platform requirements stored in the lock file

getMinimumStability()

No description

getStabilityFlags()

No description

getPreferStable()

No description

getPreferLowest()

No description

getPlatformOverrides()

No description

getAliases()

No description

getLockData()

No description

bool
setLockData(array $packages, mixed $devPackages, array $platformReqs, mixed $platformDevReqs, array $aliases, string $minimumStability, array $stabilityFlags, bool $preferStable, bool $preferLowest, array $platformOverrides)

Locks provided data into lockfile.

Details

__construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, string $composerFileContents)

Initializes packages locker.

Parameters

IOInterface $io
JsonFile $lockFile lockfile loader
RepositoryManager $repositoryManager repository manager instance
InstallationManager $installationManager installation manager instance
string $composerFileContents The contents of the composer file

static string getContentHash(string $composerFileContents)

Returns the md5 hash of the sorted content of the composer file.

Parameters

string $composerFileContents The contents of the composer file.

Return Value

string

bool isLocked()

Checks whether locker has been locked (lockfile found).

Return Value

bool

bool isFresh()

Checks whether the lock file is still up to date with the current hash

Return Value

bool

RepositoryInterface getLockedRepository(bool $withDevReqs = false)

Searches and returns an array of locked packages, retrieved from registered repositories.

Parameters

bool $withDevReqs true to retrieve the locked dev packages

Return Value

RepositoryInterface

Exceptions

RuntimeException

Link[] getPlatformRequirements(bool $withDevReqs = false)

Returns the platform requirements stored in the lock file

Parameters

bool $withDevReqs if true, the platform requirements from the require-dev block are also returned

Return Value

Link[]

getMinimumStability()

getStabilityFlags()

getPreferStable()

getPreferLowest()

getPlatformOverrides()

getAliases()

getLockData()

bool setLockData(array $packages, mixed $devPackages, array $platformReqs, mixed $platformDevReqs, array $aliases, string $minimumStability, array $stabilityFlags, bool $preferStable, bool $preferLowest, array $platformOverrides)

Locks provided data into lockfile.

Parameters

array $packages array of packages
mixed $devPackages array of dev packages or null if installed without --dev
array $platformReqs array of package name => constraint for required platform packages
mixed $platformDevReqs array of package name => constraint for dev-required platform packages
array $aliases array of aliases
string $minimumStability
array $stabilityFlags
bool $preferStable
bool $preferLowest
array $platformOverrides

Return Value

bool