Skip to main content

Module path_install

Module path_install 

Source
Expand description

Composer\Downloader\PathDownloader (docs/reference/PathDownloader.php) for Linux and macOS: a path package is laid out as a symbolic link to its source — relative through findShortestPath(..., preferRelative) when transport-options.relative (the default), absolute otherwise — or as a mirror (symlink: false, or COMPOSER_MIRROR_PATH_REPOS) copied through the ArchivableFilesFinder rules (docs/reference/ ArchivableFilesFinder.php, GitExcludeFilter.php, BaseExcludeFilter.php, symfony-finder-Glob.php) and Symfony’s Filesystem::mirror/copy (docs/reference/symfony-Filesystem.php):

  • VCS directories (.git, .svn, .hg, …) are skipped at any depth — directories only, a .git file is copied;
  • the root .gitattributes lines <pattern> export-ignore / -export-ignore (exactly two fields) exclude/re-include, the pattern through Glob::toRegex, matched at any depth unless it starts with /;
  • a symbolic link is recreated with its raw target when it points to a file or an empty directory inside the source; a link to a non-empty directory, a dangling link or a link leaving the source is dropped;
  • empty directories are kept; a copied file gets 0666 & ~umask plus the source’s executable bits and the source’s mtime.

Windows (junctions) is out of scope: scope routes such locks to the Composer fallback there.

Enums§

Strategy

Functions§

check_not_inside_source
download: the refusal to install a package inside its own source.
glob_to_regex
Symfony Finder\Glob::toRegex($glob) with the defaults (strictLeadingDot, strictWildcardSlash, delimiter #).
install
install after the CLI printed the operation line: the existing path is removed, then the link is created or the source mirrored. Nothing happens when the path already resolves to the source.
install_appendix
getInstallOperationAppendix: what follows the operation line — : Source already present when the install path already resolves to the source, else the strategy and the dist url as written.
is_own_source
PathDownloader::remove: true when the install path is the source (, source is still present in <path>): nothing is removed then.
remove_path
Filesystem::removeDirectory on a package path: a symbolic link is unlinked (never followed), a directory removed, a missing path ignored.
strategy
computeAllowedStrategies: COMPOSER_MIRROR_PATH_REPOS (PHP truthiness: anything but empty and 0) then transport-options.symlink.