How To Download Magento 2.2.2 with Sample data using Composer?
-
21-12-2020 - |
Question
I know how to install Magento 2 using composer. Magento latest release of version Magento 2.2.2. I don't know how to download or Installation with sample data Using Composer. I try to run direct
"composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.2.2 ."
But I need direct inject with sample data. It's possible?
Solution
You can either install sample data before or after installation of magento.
Before installation
Here is a list of all sample data modules which you can add to you composer.json
"magento/module-bundle-sample-data": "100.1.*",
"magento/module-cms-sample-data": "100.1.*",
"magento/module-widget-sample-data": "100.1.*",
"magento/module-theme-sample-data": "100.1.*",
"magento/module-review-sample-data": "100.1.*",
"magento/module-customer-sample-data": "100.1.*",
"magento/module-wishlist-sample-data": "100.1.*",
"magento/module-sales-sample-data": "100.1.*",
"magento/module-tax-sample-data": "100.1.*",
"magento/module-catalog-sample-data": "100.1.*",
"magento/module-catalog-rule-sample-data": "100.1.*",
"magento/module-sales-rule-sample-data": "100.1.*",
"magento/module-downloadable-sample-data": "100.1.*",
"magento/module-msrp-sample-data": "100.1.*",
"magento/module-configurable-sample-data": "100.1.*",
"magento/module-product-links-sample-data": "100.1.*",
"magento/module-grouped-product-sample-data": "100.1.*",
"magento/module-swatches-sample-data": "100.1.*",
"magento/sample-data-media": "100.1.*",
"magento/module-offline-shipping-sample-data": "100.1.*",
After installation
Simply follow this instruction: http://devdocs.magento.com/guides/v2.2/install-gde/install/sample-data-after-composer.html
In short run: php bin/magento sampledata:deploy && composer install && php bin/magento setup:upgrade
OTHER TIPS
Unfortunately no, you can't install sample data in composer command itself.
You can check the documentation and all the parameters that can used for the same here
If you want to install the sample data you can always follow @Bartosz Herba 's answer.