Install Magento via Composer

Magento Update

You can use firegento/magento repo, supported by Firegento Magento Community to install magento with composer, where you will:

  • find all magento versions with patches
  • easily install/update magento with only one command
  • get support from community on core bugs

New project

Let’s create a clean magento installation and start with empty folder for our project.

To generate composer.json and install magento for the first time run:

composer init
composer require magento-hackathon/magento-composer-installer ~3.0
composer require aydin-hassan/magento-core-composer-installer ~1.2
composer require firegento/magento ~1.9.2.2

Composer configuration in detail

composer.json will look like this:

{  
    "require": {  
      "magento-hackathon/magento-composer-installer": "~3.0",  
      "aydin-hassan/magento-core-composer-installer": "~1.2",  
      "firegento/magento": "~1.9.2"  
    },  
    "extra": {  
      "magento-root-dir": "src",  
      "auto-append-gitignore": false,  
      "magento-deploystrategy": "symlink",  
      "magento-force": true  
    }  
}

extra section has the following parameters:

  • magento-root-dir — path to magento root directory. It is recommended t o have sub folder, but you can always use current directory (.).
  • auto-append-gitignore — if true, composer installer will add all deployed files of installed magento modules to .gitignore file inside magento root directory. It is useful in case you don’t want to add module files to your repository
  • magento-deploystrategy: copy|symlink — files can be either copied or it can be just symlinks to vendor folder
  • magento-force — if true then composer will overwrite already deployed files on install

Composer will create folders src and vendor. I recommend to add those folders to .gitignore of your project root.

Read more about magento-composer-installer configuration.