1

I want to modify one extension from public GitHub repository(fork), and install it to my Magento2 via composer.

Extensions stored here GitHub. Really, i need only one sample-external-links. I tried many times to configure composer.json in my Magento2 root, but it doesn't work, i receive errors:

[Composer\Downloader\TransportException] The "https://api.github.com/repos/magento/magento2-samples/sample-external-links" file could not be downloaded (HTTP/1.1 404 Not Found)

How to configure composer to install only 1 package from some repository like that?

my composer.json:

{
"name": "magento/project-community-edition",
"description": "eCommerce Platform for Growth (Community Edition)",
"type": "project",
"version": "2.1.0",
"license": [
    "OSL-3.0",
    "AFL-3.0"
],
"require": {
    "magento/product-community-edition": "2.1.0",
    "composer/composer": "@alpha",
    "magento/sample-bundle-all": "dev-master"
},
"require-dev": {
    "phpunit/phpunit": "4.1.0",
    "squizlabs/php_codesniffer": "1.5.3",
    "phpmd/phpmd": "@stable",
    "pdepend/pdepend": "2.2.2",
    "fabpot/php-cs-fixer": "~1.2",
    "lusitanian/oauth": "~0.3 <=0.7.0",
    "sebastian/phpcpd": "2.0.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,
"repositories": [
    {       "type": "vcs",
            "url": "https://github.com/magento/magento2-samples/sample-external-links"
    }
],
"extra": {
    "magento-force": "override"
}
  • because it's just folder, not a repo – bxN5 Mar 9 '17 at 17:39
1

Each sample is packaged and available individually at repo.magento.com (The external sample isn't available individually). For convenience and demonstration of them bundling of modules, they have included the sample-bundle-all composer metapackage. Including this dependency in your Magento project is the more convenient way to integrate the full set of examples.

So to install the sample-bundle-all, run this command in your root installation folder.

composer config repositories.magento composer https://repo.magento.com/

Add the following code in the composer.json under the require section.

"magento/sample-bundle-all": "*"

And run:

alias mage="php -d memory_limit=-1 -f bin/magento"

chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
composer install && composer update -vv && 
php -r "opcache_reset();"
mage cache:flush &
mage setup:static-content:deploy && 
mage indexer:reindex &
mage setup:upgrade &&
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/

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.