9
Composer Getting started https://getcomposer.org/

Composer intro

Embed Size (px)

Citation preview

Page 1: Composer intro

ComposerGetting started

https://getcomposer.org/

Page 2: Composer intro

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

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
Page 5: Composer intro

Composer is installed Now what?

Page 6: Composer intro

Time to use it in a projectcomposer.json

{ "require": { "acquia/acquia-sdk-php": "*" } }

Page 7: Composer intro

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

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

Demo time