Composer platform configuration and platform-check execution timing
0 reputation · 02 Jun 2022, 03:00 UTC
Composer platform configuration and platform-check execution timing
The goal is to guarantee that the runtime environment validation generated by Composer's platform-check feature runs before any application code is loaded, ensuring that a simulated PHP version and extensions are actually present.
When the platform setting is used to fake PHP 8.1 and certain extensions, Composer writes a platform_check.php file that is required by the autoloader. However, it is unclear whether this check is always executed when the autoloader is optimized with a class map or when the autoloader is dumped in different modes, e.g., -o vs --apcu-autoloader.
Specifically, does the platform-check script get included and executed in all autoloader variants, and can its execution be suppressed or bypassed by certain autoloader optimizations?