Skip to main content

Crate composer_autoload

Crate composer_autoload 

Source
Expand description

Generate Composer-compatible vendor/composer/autoload_*.php.

Goal per AUTOLOADER_PLAN.md: byte-equivalent output to Composer’s own dump-autoload, pinned to a specific upstream version (2.8.12 as of the initial fixture set). Performance-first design: parallel file scan, SIMD byte search in the classmap pipeline, lazy I/O.

Status: every file composer dump-autoload writes under vendor/ is now emitted byte-equivalent across the fixtures in tests/fixtures/: vendor/autoload.php, vendor/composer/autoload_{namespaces,psr4,classmap,files,real,static}.php, the vendored ClassLoader.php / InstalledVersions.php / LICENSE, and installed.{json,php}. Conditional features wired in: --optimize, --classmap-authoritative, --no-dev, --apcu-autoloader (with explicit apcu_prefix override for tests), config.autoloader-suffix (composer.json override of the content-hash), and config.platform-check → platform_check.php (the PHP-version + extension guard, byte-equivalent to Composer; see emit::platform_check, built on composer_semver’s constraint lower-bound extraction).

Structs§

AutoloadHeader
Snapshot of the inputs that produced this autoloader’s state. Compared against a fresh DumpRequest to detect drift: a header match means a live patch is sufficient; a mismatch means the project needs a full re-bootstrap.
Autoloader
One project’s classmap model.
DumpReport
Summary returned by dump_autoload. class_count matches Composer’s containing N classes figure: total entries in the emitted classmap (always includes the synthetic Composer\InstalledVersions row, mirroring Composer).
DumpRequest
Inputs for an autoload dump. Names mirror Composer terminology.
HeaderFlags
PsrWarning
PSR-noncompliance report for a single class. Composer prints one of these per rejected class when a file’s classes all failed the psr-4 / psr-0 namespace+path rule: it drops every class in the file and warns. The caller collects them so it can render the same Class X located in Y does not comply with psr-N autoloading standard. Skipping. line.

Enums§

DumpError

Constants§

REFERENCE_COMPOSER_VERSION
Pinned upstream Composer version that fixtures + byte-equivalence tests are generated against. Bump in lockstep with regenerating tests/fixtures/.

Functions§

dump_autoload
Generate vendor/composer/autoload_*.php for the given project.
user_code_roots
Directories the server’s filesystem watcher needs to arm for live patches: every root autoload scan_root plus the scan_roots of any dist.type: "path" package in composer.lock. Vendor proper (zip / tar dists) is intentionally excluded — those only change via composer install, which rewrites composer.lock and triggers a full re-bootstrap.