2

There are some explanations on Stackexchange on how to require a specific commit with composer, for example these:

However, I can't figure out how to do this for the Magento 2 repository. I want to have this commit in my repository: https://github.com/magento/magento2/commit/beeae93d25ca4a35e7b4879f9447cc82119872aa

What I have tried so far

1.) composer require magento/magento2 "dev-develop#beeae93"

Error:

The requested package magento/magento2 could not be found in any version

2.) composer require magento/product-community-edition "dev-develop#beeae93"

Error:

The requested package magento/product-community-edition dev-developer#beeae93 exists as magento/product-community-edition[2.1.8, [...]`

My composer.json file

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.0.10",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://repo.magento.com/"
        },
        "foomanartifacts": {
            "type": "artifact",
            "url": "vendor/fooman/packages"
        },
        "iways_paypalplus": {
            "type": "git",
            "url": "git@github.com:i-ways/magento2-paypal-plus.git"
        }
    },
    "require": {
        "magento/product-community-edition": "2.1.8",
        "composer/composer": "@alpha",
        "iways/module-pay-pal-plus": "^1.0"
    },
    "require-dev": {
        "phpunit/phpunit": "4.1.0",
        "squizlabs/php_codesniffer": "1.5.3",
        "phpmd/phpmd": "2.3.*",
        "pdepend/pdepend": "2.2.2",
        "sjparkinson/static-review": "~4.1",
        "fabpot/php-cs-fixer": "~1.2",
        "lusitanian/oauth": "~0.3 <=0.7.0"
    },
    "config": {
        "use-include-path": true
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": "app/code/"
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "alpha",
    "prefer-stable": true,
    "extra": {
        "magento-force": "override"
    }
}
1

This is not possible. The Magento 2 composer repositories are maintained separately from the development repository in GitHub.

That means:

  • there is one repository per module (magento/product-community-edition is a meta package)
  • the commit hashes are not the same
  • only released versions are in the composer repository

The consequence is that if you want to use any pre-alpha version of Magento 2, you cannot use composer but you will have to use the contributor installation by cloning the repository, as described here: http://devdocs.magento.com/guides/v2.1/install-gde/prereq/dev_install.html This is not meant for production

If you clone the Magento 2 GitHub repository, you cannot use the Magento software in a production environment. You cannot have a live store that accepts orders and so on.

Alternative solution

To address your actual problem, namely include certain bug fixes in your installation, you can use a different approach.

I can recommend the symlinker-pro tool, as presented at https://speakerdeck.com/mhauri/mm17de-magento-2-in-production

It allows you to create a module with fixes in any files which will overwrite the core files with symlinks.

  • Interesting answer, thanks. Why would you use the symlinker-pro tool instead of creating a preference for the class I want to change in a Magento extension? – simonthesorcerer Sep 20 '17 at 13:47
  • 1
    @simonthesorcerer in cases where it is not possible (abstract classes, non-php files) – Fabian Schmengler Sep 20 '17 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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