After this lesson you can verify your terminal tools and choose an installation route appropriate to your machine. You will create a safe place for the fictional bookshop exercises before changing dependency files.
Check what already exists
Run these commands in a terminal. They inspect executables; they do not install packages or change a project's requirements.
php --version
composer --versionExample output captured on 2026-11; yours will differ. These are selected version lines, with build paths omitted:
PHP 8.4.24 (cli) (built: Jul 29 2026 05:29:50) (NTS)
Composer version 2.10.2 2026-07-01 11:24:45This course teaches Composer 2.10.2 with PHP 8.4.24 as of 2026-11. Another Composer 2 release may format progress messages differently. Compare the meaning of an error and the resulting files instead of demanding identical timestamps. A missing command means your terminal cannot find that executable; it does not mean the application needs a different package constraint.
PHP can exist in several installations on the same machine. The terminal may run one version while a web server uses another. Composer checks the PHP environment in which it runs. Later, you must also verify the actual deployment runtime. A successful local installation cannot prove that a different server has the same extensions.
Choose an official installation method
Composer's official Introduction and installation guide explains local and global installation and the Windows installer. Use the instructions for your operating system. A local PHAR is a PHP archive you invoke with PHP; a global installation makes a launcher available through your shell's search path.
Do not run an installer command copied from an old tutorial without checking its current verification procedure. The official procedure checks the downloaded installer against the expected signature. A signature value copied permanently into a lesson would eventually become stale, so this course deliberately sends you to the current official instructions instead of distributing an installer snapshot.
Installing software can require operating-system permissions or a browser. That action was not performed as part of this course's verification because Composer was already present. The verified starting point is the pair of version checks above. If you need to install it, complete the official instructions and repeat those checks before moving on.
A global executable does not mean global application dependencies. Running Composer from a particular project normally operates on that project's manifest. Avoid using a global package installation as a substitute for the requirements of an application you intend to share.
Prepare your learning directory
Use a new disposable folder called composer-lab, with two sibling directories planned beneath it: book-label for the reusable library and shop for its consumer. You can create them using your file manager. Keep the parent folder outside existing applications. Later lessons specify which directory each command expects.
The examples use a terminal with Unix-style quoting. Windows users can use a compatible shell, or adjust quoting while keeping the JSON and PHP contents unchanged. A command failing because of shell quoting is different from Composer rejecting a version constraint. When reporting a problem, include the shell and command, but remove private filesystem paths and authentication data.
You do not need a database, web server, account or production configuration for this course. No lesson asks you to copy an existing application's environment file. Keep the experiment small enough that you can delete the disposable workspace and rebuild it from the lessons.
Know what successful setup proves
Seeing version output proves the terminal can launch PHP and Composer. It does not prove that network access works, that a package exists, or that every platform requirement is installed. Each later step adds a more specific check. This layered approach keeps a missing executable from being mistaken for a dependency-resolution problem.
Keep a short note of your own versions. When an option behaves differently, consult the official command reference for the version you actually run. Do not suppress errors just to match a tutorial screenshot. Resolve the reason for the mismatch before proceeding.
Common mistakes
Running terminal commands inside a PHP source file produces syntax errors because shell commands are not PHP statements. Run them in the terminal instead. Another common mistake is installing Composer successfully but continuing to use an already-open terminal whose search path has not refreshed.
Avoid running Composer as an administrator merely to bypass a filesystem problem. Use a workspace your normal account owns. Package operations can involve executable code, which should not receive unnecessary privileges.
Exercise
Your terminal reports PHP 8.4, but the application's web diagnostics report another PHP release. Which version does this terminal's Composer command check, and what should you do before deployment?
Show the answer
It checks the PHP environment running Composer in the terminal. Compare that environment with the intended deployment runtime, including extensions. Later use the platform-check command on the actual target environment; do not assume that matching a local tutorial proves server compatibility.
Continue learning
Previous: Composer and Packagist: who does what
Next: Composer manifests and locks: intent versus resolution
Related: Composer PSR-4: loading the bookshop library
Related: Composer packages: path repositories, Git tags and publishing
Key points
- Check PHP and Composer in the terminal before debugging packages.
- Use the current official installer instructions instead of a copied checksum.
- Work in a disposable directory with no credentials or application data.