- 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/
.
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"
}
}
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"
}
}
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