12. Tools & Composer
What is Composer?
JuniorAnswer: A dependency manager for PHP that allows you to declare the libraries your project depends on and manages (install/update) them for you.
What is the difference between composer.json and composer.lock?
Junior
Answer:
composer.json: Lists the required dependencies and their version constraints.composer.lock: Stores the exact versions of the packages that were installed.
What is the difference between composer install and composer update?
Junior
Answer:
composer install: Checks forcomposer.lockfile. If it exists, it installs the exact versions listed there. If not, it readscomposer.json, installs the latest compatible versions, and creates the lock file.composer update: Ignorescomposer.lockand tries to update all packages to the latest versions allowed by the constraints incomposer.json, then updates the lock file.
What is Autoloading and how does Composer handle it?
MiddleAnswer: Autoloading automatically loads class files when they are needed. Composer uses PSR-4 (and others) to map namespaces to directories.