composer intro
TRANSCRIPT
![Page 2: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/2.jpg)
What is composer?
Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.
https://getcomposer.org/doc/00-intro.md#introduction
![Page 3: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/3.jpg)
How does it work?
• Composer is a phar archive that runs as an executable in your system
• Download composer.phar to your system and put it in your PATH.
• Run “composer” as you would any other CLI tool.
![Page 4: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/4.jpg)
![Page 5: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/5.jpg)
Composer is installed Now what?
![Page 6: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/6.jpg)
Time to use it in a projectcomposer.json
{ "require": { "acquia/acquia-sdk-php": "*" } }
![Page 7: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/7.jpg)
composer install• Installs a known state of dependencies into your
project.
• uses composer.lock to work out what libraries and versions need to be downloaded into the vendor directory
• if no composer.lock file exists, this command is the same as running “composer update”.
![Page 8: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/8.jpg)
composer update
• Updates your dependencies to their latest versions according to the composer.json file.
• Updates composer.lock with the new state information.
• Updates actual libraries in vendor directory with new state.
![Page 9: Composer intro](https://reader036.vdocument.in/reader036/viewer/2022072000/55d6eb47bb61eb990d8b45f7/html5/thumbnails/9.jpg)
Demo time