grep -i ./glossary

Glossary of this post

15 terms from the post “8.3 in the file, 8.2 on the server: what Composer really checks before it installs”. Every term has a permanent address, and you can pin terms for review and export them.

Back to the post

  1. Composer

    PHP's dependency manager

    Full explanation Composer downloads the libraries the project relies on into the vendor folder, and makes sure that their versions suit each other and the PHP version. It checks the match during update, require and install, and checks again at the start of every request, through the file platform_check.php.

    Why remember it The tool that checks that the packages match the PHP version

    #composer
  2. Lock File

    The file `composer.lock`: the exact versions that were installed

    Full explanation The composer update command writes the exact version of each package into it, and the composer install command installs exactly what is recorded in it. Composer also records in it the value of the config.platform setting, in the platform-overrides field, and install checks against that value.

    Why remember it You install from it, and its backup is the way back

    #lock-file
  3. Dependency Resolver

    The part of Composer that chooses versions that suit each other and the environment

    Full explanation During update and require it chooses, for each package, a version that meets all the requirements, the requirement on the PHP version among them. It takes the PHP version from the config.platform setting, and only when there is no such value, from the PHP that runs Composer.

    Why remember it The first guard: it believes the setting

    Where it appears in the post

    #dependency-resolver
  4. Platform Package

    PHP and its extensions, which Composer treats as packages

    Full explanation A package that cannot be installed, but can be required: php, extensions (ext-*) and system libraries (lib-*). Composer takes its version from the machine it runs on, unless the config.platform setting tells it otherwise.

    Why remember it The requirement "PHP 8.3 or higher" is a requirement on such a package

    #platform-package
  5. config.platform

    A setting that tells Composer which version to assume

    Full explanation A setting in the composer.json file. Composer resolves dependencies as if the version written in it is the installed version, regardless of the PHP that really runs. The right value is the lowest version the code will run on, that is, the server's version.

    Why remember it It helps when it describes the server, and does harm when it does not

    #config-platform
  6. Autoloader

    The file through which the packages' classes are loaded

    Full explanation The application loads vendor/autoload.php once, and from that moment every class is loaded from its own file the moment it is used. The file loads autoload_real.php, which first of all runs platform_check.php.

    Why remember it Every request passes through it, so the check sits in it

    #autoloader
  7. Platform Check

    The check that runs at the start of every request, from the file `platform_check.php`

    Full explanation Composer generates the file vendor/composer/platform_check.php on every install, update or dump-autoload. The file compares PHP_VERSION_ID with the strictest requirement among the installed packages. When the version is too low, it sends a 500 header and stops the request. The platform-check setting determines whether it checks only the PHP version (php-only, the default), the extensions too (true), or is not generated at all (false).

    Why remember it The third guard: it checks the PHP that really runs

    #platform-check
  8. PHP_VERSION_ID

    The PHP version as a single number, for example 80300

    Full explanation A PHP constant: the major version times 10,000, plus the minor version times 100, plus the patch number. 8.3.0 is 80300, and 8.2.20 is 80220.

    Why remember it The condition in the check file is checked against it

    Where it appears in the post

    #php-version-id
  9. check-platform-reqs

    A command that checks the packages against the PHP and the extensions that really exist

    Full explanation The composer check-platform-reqs command ignores the config.platform setting and checks the installed packages against the PHP that runs it. When there is a mismatch, it ends with a non-zero exit code. With the --lock option it checks what is recorded in the composer.lock file, even before it is installed.

    Why remember it The check you run before a restart

    #check-platform-reqs
  10. Exit Code

    The number a program returns when it ends: 0 for success

    Why remember it It lets a deployment script stop when the check fails

    Where it appears in the post

    #exit-code
  11. OPcache

    A cache of compiled PHP code

    Full explanation PHP compiles every file before it runs it, and OPcache keeps the result in memory. In the default setting it checks every two seconds whether the file has changed (opcache.validate_timestamps). When this check is off, a changed file is loaded only after the cache is reset or after a restart.

    Why remember it Because of it, old code can keep running after an update

    #opcache

Glossary term

Why remember it

Where it appears in the post

    Open in the glossary

    Saved in this browser only

    My pinned terms

    No pinned terms yet. You can pin a term from its explanation, or from the glossary page.

      Pinned terms on the glossary page

      Search and commands