2. WHAT IS COMPOSER……?
• Composer is an application-level package manager for the PHP programming language that
provides a standard format for managing dependencies of PHP software and
required libraries. OR
• Composer is a tool for dependency management in PHP. It allows you to declare the
libraries your project depends on and it will manage (install/update) them for you.
• Composer is strongly inspired by Node.js's "npm" and Ruby's "bundler".
• Composer runs through the command line and installs dependencies (e.g. libraries) for an
application. It also allows users to install PHP applications that are available on
"Packagist"[5] which is its main repository containing available packages. It also
provides autoload capabilities for libraries that specify autoload information to ease usage of
third-party code.
3. SUPPORTED FRAMEWORK
• Symfony version 2 and later
• Laravel version 4 and later
• CodeIgniter version 3.0 and later
• CakePHP version 3.0 and later
• FuelPHP version 2.0 and later
• Drupal version 8 and later
• SilverStripe version 3.0 later
• Magento version 2.0 later
• Yii
• Zend Framework version 1 and later
• Silex (web framework)
4. REQUIREMENTS
• We need PHP to be installed in our machine.
• Ways of installing in Composer:
• 1.command line
• and 2.Manual Setup
• We need PHP to be installed in our machine.
• Ways of installing in Composer:
• 1.command line
https://getcomposer.org/download/
• and 2.Manual Setup
5. COMPOSER COMMANDS
To initialize :---- $composer init
To show packages:--- $composer show
To remove packages:--- $composer remove
To install packages:---- $composer require vendor/package_name:version
To include in project, If project uses composer:--- $composer install
Packages only for development:-- $composer require –dev [vendor/package]
To check packages outdated :-- $composer outdated
7. VERSION RANGES
• 0.3.2 using fixed version.
• 0.3.* is equivalent to (>=0.3 and <0.4)
• ~1.2 is equivalent to >=1.2 and <2.0.0
• ~1.2.3 is equivalent to >=1.2.3 and <1.3.0
• ^1.2.3 is equivalent to >=1.2.3 and <1.3.0
8. COMPOSER LOCK AND GIT
• Exact copy across multiple projects. Information about all the packages & what
version need to be include in particular project,so it lock to those specific version
numbers.
• Pipe ”|” when we update package, If it show’s I symbol then it indicates that it will
break package files if it updated to latest version, so try to update to incremental
version.
• Push code to GIT
Avoid push vendor folder, bcoz composer.json include all require folders with
$composer install