Install package to a custom path with composer doesn't working

I used this link, but for me doesn't working...

{
"name": "vendor/work-team-betting",
"description": "Team betting webapplication for an event.",
"type": "webapplication",
"authors": [
    {

    }
],
"config": {
    "vendor-dir": "application/vendor"
},
"extra": {
    "installer-paths": {
        "application/framework/{$name}": ["yiisoft/yii"]
    }
},
"require": {
    "composer/installers": "~1.0",
    "yiisoft/yii": "1.1.14"         
}
}

I use this composer.json, but after installation the composer didn't move the yiisoft/yii into my application/framework/ directory. Anybody can help me, what did I do wrong? :)

Upvotes: 4

Views: 1042

Answers (4)

Maxim Rysevets
Maxim Rysevets

Reputation: 156

I found solution for my CMS EFFCORE...

File composer.json:

"name": "project_n",
"type": "project",
"require": {
    "composer/installers": "^1.9",
    "oomphinc/composer-installers-extender": "^2.0"
},
"config": {
    "allow-plugins": {
        "composer/installers": true,
        "oomphinc/composer-installers-extender": true
    }
}
"extra": {
    "installer-types": [
        "MY_TYPE-module"
    ],
    "installer-paths": {
        "modules/{$name}": [
            "type:MY_TYPE-module"
        ]
    }
}

File composer.json in module:

"name": "project_n/module_m",
"type": "MYTYPE-module",

Upvotes: 0

Social Niche Guru
Social Niche Guru

Reputation: 1

This solved it for me. The custom modules and themes were all being installed in vendor directory. installed-paths.

I needed to also do the following.

Add your custom types to the "installer-types":

"installer-types": ["library","my-type-1","my-type-2"]

https://packagist.org/packages/oomphinc/composer-installers-extender

Upvotes: 0

Bravehartk2
Bravehartk2

Reputation: 1614

In general schmunk is totaly right. But one workaround could be to fork the original Yii repository and build up your own one, where you only change everything to use it with composer installer.

Basically you need to define a own type or misuse an existing one.

I found a good tutorial on how to extend composer installer by own types here:

http://clearcode.cc/2014/10/composer-installer-plugin-usage/

And I have written an article about how I used the composer installer package to get my packages installed to a custom folder:

http://www.ask-sheldon.com/custom-install-path-composer/

The important point is, that I misused another repository type to get it work the way I wanted it. Perhaps these information help you to do the same with a fork of the Yii-package.

Upvotes: 0

schmunk
schmunk

Reputation: 4708

That's not possible, because Yii does (and will) not use custom composer installers, which would be required to make this work.

To quote from the composer installers README:

The following frameworks natively work with Composer and will be installed to the default vendor directory. composer/installers is not needed to install packages with these frameworks: [...] Yii

https://github.com/composer/installers

This also applies to the framework package itself and I'd strongly recommend you not to change this behavior.

If you need to work around some glitches, these articles may be helpful to you:

Upvotes: 2

Related Questions