0
0
PHPprogramming~10 mins

Composer installation and setup in PHP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if Composer is installed by displaying its version.

PHP
composer [1]
Drag options to blanks, or click blank then click option'
Aupdate
B--version
Crequire
Dinstall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of '--version' will try to install packages.
Using 'update' changes packages, not shows version.
2fill in blank
medium

Complete the command to install Composer globally on your system.

PHP
php -r "copy('https://getcomposer.org/installer', '[1]');"
Drag options to blanks, or click blank then click option'
Asetup.php
Bcomposer.phar
Ccomposer-setup.php
Dinstall.php
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'composer.phar' downloads the binary, not the installer script.
Using 'install.php' or 'setup.php' are incorrect file names.
3fill in blank
hard

Fix the error in the command to move Composer to a global location.

PHP
mv [1] /usr/local/bin/composer
Drag options to blanks, or click blank then click option'
Acomposer.phar
Bcomposer
Ccomposer-setup.php
Dcomposer.phar.php
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to move the installer script instead of the binary.
Using a wrong file name like 'composer.phar.php'.
4fill in blank
hard

Fill both blanks to create a new PHP project with Composer and install a package.

PHP
composer [1] && composer [2] monolog/monolog
Drag options to blanks, or click blank then click option'
Ainit
Binstall
Crequire
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of 'init' to start a project.
Using 'update' instead of 'require' to add packages.
5fill in blank
hard

Fill all three blanks to update Composer and check its version.

PHP
composer [1] && php [2] --version
Drag options to blanks, or click blank then click option'
Aself-update
Bcomposer.phar
C-d
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'update' instead of 'self-update' to update Composer.
Not specifying the Composer binary file when running with PHP.