Composer
Getting started
https://getcomposer.org/
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
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.
Composer is installed
Now what?
Time to use it in a project
composer.json
{
"require": {
"acquia/acquia-sdk-php": "*"
}
}
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”.
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.
Demo time

Composer intro

  • 1.
  • 2.
    What is composer? Composeris 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
  • 3.
    How does itwork? • 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.
  • 5.
  • 6.
    Time to useit in a project composer.json { "require": { "acquia/acquia-sdk-php": "*" } }
  • 7.
    composer install • Installsa 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”.
  • 8.
    composer update • Updatesyour 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.
  • 9.