class DownloadManager (View source)

Downloaders manager.

Methods

__construct(IOInterface $io, bool $preferSource = false, Filesystem $filesystem = null)

Initializes download manager.

setPreferSource(bool $preferSource)

Makes downloader prefer source installation over the dist.

setPreferDist(bool $preferDist)

Makes downloader prefer dist installation over the source.

setPreferences(array $preferences)

Sets fine tuned preference settings for package level source/dist selection.

setOutputProgress(bool $outputProgress)

Sets whether to output download progress information for all registered downloaders

setDownloader(string $type, DownloaderInterface $downloader)

Sets installer downloader for a specific installation type.

getDownloader(string $type)

Returns downloader for a specific installation type.

getDownloaderForInstalledPackage(PackageInterface $package)

Returns downloader for already installed package.

download(PackageInterface $package, string $targetDir, bool $preferSource = null)

Downloads package into target dir.

update(PackageInterface $initial, PackageInterface $target, string $targetDir)

Updates package from initial to target version.

remove(PackageInterface $package, string $targetDir)

Removes package from target dir.

string
resolvePackageInstallPreference(PackageInterface $package)

Determines the install preference of a package

Details

__construct(IOInterface $io, bool $preferSource = false, Filesystem $filesystem = null)

Initializes download manager.

Parameters

IOInterface $io The Input Output Interface
bool $preferSource prefer downloading from source
Filesystem $filesystem custom Filesystem object

DownloadManager setPreferSource(bool $preferSource)

Makes downloader prefer source installation over the dist.

Parameters

bool $preferSource prefer downloading from source

Return Value

DownloadManager

DownloadManager setPreferDist(bool $preferDist)

Makes downloader prefer dist installation over the source.

Parameters

bool $preferDist prefer downloading from dist

Return Value

DownloadManager

DownloadManager setPreferences(array $preferences)

Sets fine tuned preference settings for package level source/dist selection.

Parameters

array $preferences array of preferences by package patterns

Return Value

DownloadManager

DownloadManager setOutputProgress(bool $outputProgress)

Sets whether to output download progress information for all registered downloaders

Parameters

bool $outputProgress

Return Value

DownloadManager

DownloadManager setDownloader(string $type, DownloaderInterface $downloader)

Sets installer downloader for a specific installation type.

Parameters

string $type installation type
DownloaderInterface $downloader downloader instance

Return Value

DownloadManager

DownloaderInterface getDownloader(string $type)

Returns downloader for a specific installation type.

Parameters

string $type installation type

Return Value

DownloaderInterface

Exceptions

InvalidArgumentException if downloader for provided type is not registered

DownloaderInterface|null getDownloaderForInstalledPackage(PackageInterface $package)

Returns downloader for already installed package.

Parameters

PackageInterface $package package instance

Return Value

DownloaderInterface|null

Exceptions

InvalidArgumentException if package has no installation source specified
LogicException if specific downloader used to load package with wrong type

download(PackageInterface $package, string $targetDir, bool $preferSource = null)

Downloads package into target dir.

Parameters

PackageInterface $package package instance
string $targetDir target dir
bool $preferSource prefer installation from source

Exceptions

InvalidArgumentException if package have no urls to download from
RuntimeException

update(PackageInterface $initial, PackageInterface $target, string $targetDir)

Updates package from initial to target version.

Parameters

PackageInterface $initial initial package version
PackageInterface $target target package version
string $targetDir target dir

Exceptions

InvalidArgumentException if initial package is not installed

remove(PackageInterface $package, string $targetDir)

Removes package from target dir.

Parameters

PackageInterface $package package instance
string $targetDir target dir

protected string resolvePackageInstallPreference(PackageInterface $package)

Determines the install preference of a package

Parameters

PackageInterface $package package instance

Return Value

string