简体   繁体   中英

How to rename composer vendor install path?

Thats my composer.json file:

{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Project Template",
"keywords": ["yii2", "framework", "basic", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
    "issues": "https://github.com/yiisoft/yii2/issues?state=open",
    "forum": "http://www.yiiframework.com/forum/",
    "wiki": "http://www.yiiframework.com/wiki/",
    "irc": "irc://irc.freenode.net/yii",
    "source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"prefer-stable" : true,
"repositories": {
    "Leopandro": {
        "type": "package",
        "package": {
            "name": "Leopandro/yii2-user",
            "version": "dev-master",
            "source": {
                "url": "https://github.com/Leopandro/yii2-user",
                "type": "git",
                "reference":"dd41fccbab926f3719a378ddd698e7976f57eca5"
            }
        }
    }
},
"require": {
    "php": ">=5.4.0",
    "yiisoft/yii2": ">=2.0.5",
    "yiisoft/yii2-bootstrap": "*",
    "yiisoft/yii2-swiftmailer": "*",
    "Leopandro/yii2-user": "dev-master",
    "execut/yii2-widget-bootstraptreeview": "dev-master",
    "2amigos/yii2-file-upload-widget": "~1.0",
    "kartik-v/yii2-widget-select2": "@dev",
    "paulzi/yii2-adjacency-list": "^1.0"
},
"require-dev": {
    "yiisoft/yii2-codeception": "*",
    "yiisoft/yii2-debug": "*",
    "yiisoft/yii2-gii": "*",
    "yiisoft/yii2-faker": "*"
},
"autoload": {
    "psr-0": {
        "Leopandro": "vendor/Leopandro/yii2-user/"
    }
},
"config": {
    "process-timeout": 1800
},
"scripts": {
    "post-create-project-cmd": [
        "yii\\composer\\Installer::postCreateProject"
    ]
},
"extra": {
    "yii\\composer\\Installer::postCreateProject": {
        "setPermission": [
            {
                "runtime": "0777",
                "web/assets": "0777",
                "yii": "0755"
            }
        ],
        "generateCookieValidationKey": [
            "config/web.php"
        ]
    },
    "asset-installer-paths": {
        "npm-asset-library": "vendor/npm",
        "bower-asset-library": "vendor/bower"
    }
}

}

My package " Leopandro/yii2-user " installs into " vendor/Leopandro/yii2-soft ". I want to change folder name into " vendor/dektrium/yii2-soft " becouse my package depends on folder name :(

There is a package composer/installers which has to be required by your package Leopandro/yii2-user . Then the consuming project is able to change the vendor install path:

{
    "extra": {
        "installer-paths": {
            "sites/example.com/modules/{$name}": ["vendor/package"]
        }
    }
}

For detailed information see Composer Docs .

Info: Be careful with changing such things as they are usually not meant to be changed and can result in conflicts with other packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM