Expand description
vendor/bin proxies: byte-for-byte port of
BinaryInstaller::generateUnixyProxyCode (docs/reference/BinaryInstaller.php).
Three shapes: PHP target with shebang (anti-shebang stream wrapper for
PHP<8, special phpunit hack), bare PHP target, non-PHP target (sh proxy).
Parity is held by the differential test against the proxies generated by
Composer in the Laravel fixture (tests/fixtures_binproxy.rs).
Enums§
- BinCompat
- The resolved
bin-compat:Fullwrites the.batproxy in addition to the unixy proxy (BinaryInstaller::installFullBinaries),Proxywrites the unixy proxy alone (installUnixyProxyBinaries) — which is what Composer produces on plain Linux/macOS.
Functions§
- install_
binaries - Installs a package’s proxies (laid out in
package_dir) into vendor/bin (0755), following the resolvedBinCompatexactly asBinaryInstaller::installBinariesdoes:Full(bin-compat"full", or"auto"on Windows/WSL) goes through [install_full_binaries];Proxywrites the unixy proxy alone. vivacity always writes proxies (never symlinks), which is Composer’s own proxy mode. - proxy_
content - Generates the content of the proxy
link(vendor/bin/) to the binary bin(absolute, inside vendor/ or outside it with composer/installers), reading the target’s header. Relative paths are those ofBinaryInstaller::installUnixyProxyBinaries(findShortestPath from the proxy file). - resolve_
bin_ compat Config::get('bin-compat')+ the resolution inBinaryInstaller::installBinaries(2.10.3): the value comes fromCOMPOSER_BIN_COMPAT(?:inConfig::get, so""and"0"fall through) elseconfig.bin-compatof the root composer.json else the globalCOMPOSER_HOME/config.json(Config::mergelayers) else"auto", and resolves toFulliff it is"full", or"auto"on Windows or WSL (Platform::isWindows() || Platform::isWindowsSubsystemForLinux()).- resolve_
bin_ compat_ with - Pure core of
resolve_bin_compat, for tests:envis theCOMPOSER_BIN_COMPAToverride,globaltheconfig.bin-compatof the global config.json,windows_or_wslthe platform predicate. An unknown value is refused with Composer’s own message; the deprecated"symlink"is accepted and behaves like"proxy"(Composer deprecation- warns then takes the non-full branch — vivacity never symlinks anyway). - windows_
binary_ caller BinaryInstaller::determineBinaryCaller:callfor a.bator.exetarget (substr($bin, -4)— case-sensitive, and NOT.cmd); otherwise the shebang interpreter — everything after the last path segment, arguments included (#!/usr/bin/env php -dfoo→php -dfoo); otherwisephp.- windows_
proxy_ content BinaryInstaller::generateWindowsProxyCode: a.batwhose target, for aphpcaller, is the NEIGHBOURING unixy proxy (%~dp0/<name>=basename($link, '.bat')) — the one that sets the$GLOBALS['_composer_*']and includes the real binary. Any other caller (callfor a real.bat/.exetarget, a non-php shebang such assh, or a shebang carrying arguments such asphp -dfoo) targets the real binary viafindShortestPath. Composer wraps that path intrim(ProcessExecutor::escape(...), '"\''), which is the bare path again for any path without embedded quotes — the simplification kept here. Verified byte-for-byte against native Composer 2.10.3 on the psr/log + monolog + nikic/php-parser fixture, and by real execution under a Windows PHP (tests/fixtures_binproxy.rs).