0
0
PHPprogramming~5 mins

Composer installation and setup in PHP - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Composer in PHP?
Composer is a tool for managing PHP project dependencies. It helps you install and update libraries your project needs.
Click to reveal answer
beginner
How do you check if Composer is installed on your system?
Run the command composer --version in your terminal. If Composer is installed, it shows the version number.
Click to reveal answer
beginner
What is the first step to install Composer on Windows?
Download the Composer-Setup.exe from the official Composer website and run it. It guides you through the installation.
Click to reveal answer
intermediate
How do you install Composer globally on Linux or macOS?
Use these commands:<br>php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"<br>php composer-setup.php<br>php -r "unlink('composer-setup.php');"<br>Then move it to a directory in your PATH, e.g., sudo mv composer.phar /usr/local/bin/composer.
Click to reveal answer
beginner
What file does Composer use to manage project dependencies?
Composer uses a composer.json file in your project folder to list the libraries and versions your project needs.
Click to reveal answer
Which command checks the installed Composer version?
Acomposer install
Bphp composer.json
Ccomposer --version
Dphp --version
What is the main purpose of Composer in PHP projects?
AManage project dependencies
BCompile PHP code
CRun PHP scripts
DCreate databases
Where is the composer.json file located?
AIn the project root folder
BIn the PHP installation folder
CIn the system's temp folder
DIn the web server root
Which command installs the dependencies listed in composer.json?
Acomposer remove
Bcomposer install
Cphp composer.json
Dcomposer update
On Windows, how do you start installing Composer?
ADownload composer.json
BUse terminal command <code>php composer.phar</code>
CInstall PHP again
DRun Composer-Setup.exe
Explain the steps to install Composer globally on Linux or macOS.
Think about commands to download, run, clean up, and move the Composer file.
You got /4 concepts.
    Describe the role of the composer.json file in a PHP project.
    Consider how Composer knows what packages to install.
    You got /4 concepts.