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?

2 Answers 2


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

  • Thanks for the answer but my question - is that possible to inject command with composer command? @ Bartosz Commented Dec 14, 2017 at 6:52
  • Like "composer create-project --repository-url=repo.magento.com magento/project-community-edition=2.2.2 ." - is dictly download magento2 command but i need with sample data. understand? Commented Dec 14, 2017 at 6:53
  • I totally understand. It is obvious that you cant do it with composer create-project but you can require sample modules after, what is the deal? Commented Dec 14, 2017 at 6:59
  • You mean after composer command I need to run "php bin/magento sampledata:deploy" that's one? Commented Dec 14, 2017 at 7:02
  • No. Either, create project with composer then require all sample modules i listed or create project, install magento and then run after installation command. Commented Dec 14, 2017 at 7:05

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.