Skip to content

Instantly share code, notes, and snippets.

@ProcessEight
Last active September 3, 2019 14:18
Show Gist options
  • Save ProcessEight/65cd8b1e18bb0ae40dbf723ea956efee to your computer and use it in GitHub Desktop.
Save ProcessEight/65cd8b1e18bb0ae40dbf723ea956efee to your computer and use it in GitHub Desktop.
Setup Magento 1x using composer

Setup Magento 1x using composer

Step-by-step, from scratch

  • Create the webroot (e.g. /var/www/html/new-magento-project/htdocs/)
  • Run composer init in the webroot:
{
    "name": "projecteight/magento",
    "description": "Magento Community Edition for local dev”
}
  • Define Magento basedir:
composer config extra.magento-root-dir .

Using a period . tells the Magento Composer Installer to install Magento in the same directory as the composer.json file.

  • Install Magento:
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.3 # Install latest version of Magento 1.9.3.x branch
  • That's it. Magento is now installed in /var/www/html/new-magento-project/htdocs/.

Complete examples

Example using the Magento Composer Installer to install the latest version of Magento 1.9.3.x

This example assumes the composer.json file is in the same directory as the Magento source code.

{
  "name": "projecteight/magento",
  "description": "Magento Community 1.9.3.0",
  "extra": {
    "magento-root-dir": "."
  },
  "require": {
    "magento-hackathon/magento-composer-installer": "~3.0",
    "aydin-hassan/magento-core-composer-installer": "~1.2",
    "firegento/magento": "~1.9.3"
  }
}

Example using the Magento Composer Installer without requiring the Magento source from Firegento

This example assumes the composer.json file is in the same directory as the Magento source code.

{
    "name": "projecteight/my-magento1-project",
    "description": "Magento Community 1.9.0.1",
    "extra": {
        "magento-root-dir": "."
    },
    "require": {
        "magento-hackathon/magento-composer-installer": "~3.0",
        "aydin-hassan/magento-core-composer-installer": "~1.2"
    },
    "require-dev": {
        "inchoo/php7": "1.9.2.4-dev"
    }
}

Specifying the Inchoo PHP7 compatibility extension as a requirement

To add the Inchoo PHP7 compatibility extension:

$ composer require --dev
Search for a package: inchoo/php7
Enter the version constraint to require (or leave blank to use the latest version): 1.9.2.4-dev 

Use branch 1.9.2.4-dev for CE versions < 1.9.2.4 and dev-EE for EE < 1.14.2.4. For newer versions, use version 2.0.* for both.

Or add it to the require-dev block of composer.json:

{
    "name": "projecteight/my-magento1-project",
    "description": "Magento Community 1.9.0.1",
    "extra": {
        "magento-root-dir": "."
    },
    "require": {
        "magento-hackathon/magento-composer-installer": "~3.0",
        "aydin-hassan/magento-core-composer-installer": "~1.2",
        "firegento/magento": "~1.9.3"
    },
    "require-dev": {
        "inchoo/php7": "1.9.2.4-dev"
    }
}

If you get a The requested package inchoo/php7 could not be found in any version, there may be a typo in the package name. error, make sure you have the Firegento packagist repository added:

composer config -g repositories.firegento composer https://packages.firegento.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment