Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify Composer install path?

I have this definition:

{     "repositories": [         {             "type": "package",             "package": {                 "name": "symfony/sfGuardPlugin",                 "version": "4.0.2",                 "dist": {                     "url": "http://plugins.symfony-project.org/get/sfGuardPlugin/sfGuardPlugin-4.0.2.tgz",                     "type": "tar"                 }             }         }     ],     "require": {         "symfony/sfGuardPlugin": "4.0.*"     } } 

I am using Symfony 1, and I'd like to install them on plugins/sfGuardPlugin/. How do I specify this?

like image 483
Tower Avatar asked Aug 09 '12 12:08

Tower


People also ask

How do I find the Composer path?

To install composer globally, use the following command which will download and install Composer as a system-wide command named composer , under /usr/local/bin : sudo php /tmp/composer-setup. php --install-dir= /usr/local/bin --filename= composer.


1 Answers

It seems that you can define the vendor dir to be something else (plugins in your case):

{     "config": {         "vendor-dir": "plugins"     } } 

Then, you might rename the package name to not have a level dir inside, like:

        "package": {             "name": "sfGuardPlugin", 

So, your composer.json should look like this:

{     "config": {         "vendor-dir": "plugins"     },     "repositories": [         {             "type": "package",             "package": {                 "name": "sfGuardPlugin",                 "version": "4.0.2",                 "dist": {                     "url": "http://plugins.symfony-project.org/get/sfGuardPlugin/sfGuardPlugin-4.0.2.tgz",                     "type": "tar"                 }             }         }     ],     "require": {         "sfGuardPlugin": "4.0.*"     } } 

Edit

Using this configuration, you will get the path (which is of course not good for symfony):

plugins/sfGuardPlugin/sfGuardPlugin-4.0.2/

I found a workaround with this composer.json:

{     "config": {         "vendor-dir": "plugins"     },     "repositories": [         {             "type": "package",             "package": {                 "name": "sfGuardPlugin",                 "version": "4.0.2",                 "source": {                     "url": "http://svn.symfony-project.com/plugins/sfGuardPlugin/",                     "type": "svn",                     "reference": "branches/1.3/"                 }             }         }     ],     "require": {         "sfGuardPlugin": "4.0.*"     } } 
like image 161
j0k Avatar answered Oct 15 '22 03:10

j0k