Composer API
Class

Composer\Downloader\DownloadManager

class DownloadManager

Downloaders manager.

Methods

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

Initializes download manager.

DownloadManager setPreferSource(bool $preferSource)

Makes downloader prefer source installation over the dist.

DownloadManager setPreferDist(bool $preferDist)

Makes downloader prefer dist installation over the source.

DownloadManager setPreferences(array $preferences)

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

DownloadManager setOutputProgress(bool $outputProgress)

Sets whether to output download progress information for all registered downloaders

DownloadManager setDownloader(string $type, DownloaderInterface $downloader)

Sets installer downloader for a specific installation type.

DownloaderInterface getDownloader(string $type)

Returns downloader for a specific installation type.

DownloaderInterface|null 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.

Details

at line 40
public __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

at line 53
public DownloadManager setPreferSource(bool $preferSource)

Makes downloader prefer source installation over the dist.

Parameters

bool $preferSource prefer downloading from source

Return Value

DownloadManager

at line 66
public DownloadManager setPreferDist(bool $preferDist)

Makes downloader prefer dist installation over the source.

Parameters

bool $preferDist prefer downloading from dist

Return Value

DownloadManager

at line 79
public 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

at line 93
public DownloadManager setOutputProgress(bool $outputProgress)

Sets whether to output download progress information for all registered downloaders

Parameters

bool $outputProgress

Return Value

DownloadManager

at line 109
public 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

at line 124
public 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

at line 143
public 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

at line 181
public 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

at line 240
public 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

at line 292
public remove(PackageInterface $package, string $targetDir)

Removes package from target dir.

Parameters

PackageInterface $package package instance
string $targetDir target dir