Development Workflow

Use Composer Consistently Across Local PHP Environments

Ensure Composer runs with the intended PHP binary and installs dependencies reproducibly across local environments.

Composer is a PHP dependency manager, and its behavior depends on the PHP executable that launches it. A project can appear to have Composer installed while the command is actually running under a different PHP version than the web application.

Verify the executable chain

Run php -v, php --ini, php -m and composer -V. On Windows, use where php and where composer to inspect PATH resolution. When several PHP installations exist, invoke Composer through the intended PHP binary or configure the command wrapper explicitly.

Prefer the lock file

For applications, commit composer.lock. Use composer install to reproduce the locked dependency set on another machine. Use composer update intentionally when changing dependency versions, review the lock-file diff and run tests afterward.

Check platform requirements

Composer resolves packages against PHP and extension platform packages. If the local environment lacks an extension, do not immediately bypass the requirement with --ignore-platform-reqs. Install the correct extension or use a temporary, documented platform configuration only when the deployment target truly provides the capability.

Separate development tools

Install test runners and static analyzers as development dependencies. Use project scripts so every contributor and CI runner executes the same commands. Avoid relying on globally installed tools with unpinned versions.

Keep credentials private

Composer authentication tokens and private repository credentials must not be committed or placed in the public web root. Use the supported Composer authentication configuration and protect the file with appropriate OS permissions.

Further reading

Share this page Help other developers discover this resource.