Indra Kusmana Indra Kusmana - 27 days ago 6
JSON Question

phpword composer install to another directory

I want to install phpword to another directory than its default direcroty, I already tried this in composer.json:

{
"name" : "phpoffice/phpword",
"version" : "v0.13.0",
"require": {
"composer/installers": "~1.0"
},
"extra": {
"installer-paths": {
"server/vendor/{$name}": ["vendor/package"]
}
}
}


But it's still installing to default directory, it's "project/vendor/", what I want is to install it to "project/server/vendor/"
I save my composer.json in project folder. I know it could be done by placing the composer.json in project/server folder and just do "cd server" and "composer install" or "composer install -d=/server/" in terminal, but I didn't want to do that.

Answer

all you need to do is set this directive in the composer.json

ex:

"config": {
        "vendor-dir": "libs/vendor"
    },