Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does composer install files to?

Ok, so I am trying to learn composer. I installed composer using my server's SSH and ran this line:

php composer.phar require tomwalder/php-gds

And it did this:

Using version ^2.1 for tomwalder/php-gds
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing tomwalder/php-gds (v2.1.0)
    Downloading: 100%         
tomwalder/php-gds suggests installing google/apiclient (Allows you to use the JSON API Gateway/Datastore endpoints.
 Tested with 1.1.6)
Writing lock file
Generating autoload files

Great, so now I look on my webserver and nothing seems to have changed. No files appear to be there. Where does composer install the files to?

like image 849
Amy Neville Avatar asked Feb 23 '16 13:02

Amy Neville


People also ask

Where are the packages pulled from composer stored?

composer/vendor/bin/ in your path.

How does composer install work?

composer install is primarily used in the 'deploying phase' to install our application on a production server or on a testing environment, using the same dependencies stored in the composer. lock file created by composer update .


2 Answers

Everything is a file called vendor in your current directory. Take a look at Composer documentation to get what you're looking for

like image 165
LoïcR Avatar answered Nov 10 '22 12:11

LoïcR


The core point: a vendor directory is created in your webroot, with all the packages, but most importantly an autoload.php file. Include it from your main file with require 'vendor/autoload.php'; and magically all classes are available now with the autoloaders.

The cool thing is that you can add an autoload section to your composer.json for your own project, and it will work identically.

like image 23
Niels Keurentjes Avatar answered Nov 10 '22 13:11

Niels Keurentjes