0
0
PHPprogramming~10 mins

Composer require and dependency management 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 require a package using Composer.

PHP
composer [1] monolog/monolog
Drag options to blanks, or click blank then click option'
Arequire
Bremove
Cupdate
Dinstall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of 'require' to add a package.
Using 'update' which updates existing packages but does not add new ones.
2fill in blank
medium

Complete the command to update all dependencies to the latest versions allowed by composer.json.

PHP
composer [1]
Drag options to blanks, or click blank then click option'
Aremove
Binstall
Crequire
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' which installs dependencies but does not update them.
Using 'require' which adds new packages instead of updating.
3fill in blank
hard

Fix the error in the command to remove a package.

PHP
composer [1] monolog/monolog
Drag options to blanks, or click blank then click option'
Ainstall
Bupdate
Cremove
Drequire
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'update' which updates packages but does not remove them.
Using 'require' which adds packages instead of removing.
4fill in blank
hard

Fill both blanks to check the installed version of a package and list all available Composer commands.

PHP
composer [1] monolog/monolog
composer [2]
Drag options to blanks, or click blank then click option'
Ashow
Blist
Crequire
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'require' to show package info.
Using 'update' to list packages.
5fill in blank
hard

Fill all three blanks to add a package with a specific version constraint and then update dependencies.

PHP
composer [1] guzzlehttp/guzzle:[2]
composer [3]
Drag options to blanks, or click blank then click option'
Arequire
B7.5.0
Cupdate
Dinstall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of 'update' after requiring a package.
Not specifying the version constraint correctly.