I wanna to use phpdotenv in my project. I read it installation guide and run composer require vlucas/phpdotenv
inside my project. Now it downloads many other packages except vlucas/phpdotenv in a folder named vendor as below.
Do I need to maintain all of them or vlucas/phpdotenv is enough. If yes how can I merge these folders with other vendors folder while there is an autoload.php which is need to be included.
All packages that are being installed using composer are kept under directory named as vendor
. So you will see all installed packages over here.
Now there is a feature that you require in your project(Loading environment variables from .env
) and for that you're using another package(vlucas/phpdotenv
) as your project dependency.
In the same manner vlucas/phpdotenv
package is also developed by another developer who relies on multiple packages for his project to work smoothly just like yours. So all packages which were used in this package as dependency will also be installed in your vendor
folder.
Now how these are installed:
Check composer.json
file at root of your project. It contains keys like require
and require-dev
, data inside these attributes tells composer to install packages for your project.
In the same way when you'll look composer.json
of vlucas/phpdotenv
project, you'll see a list of all of your mentioned packages inside that. Composer auto detects them and install them, so you don't have to manually installed them to make vlucas work in your project.
composer.json file of vlucas/phpdotenv
.
"require": {
"php": "^7.1.3 || ^8.0",
"ext-pcre": "*",
"graham-campbell/result-type": "^1.0.1",
"phpoption/phpoption": "^1.7.4",
"symfony/polyfill-ctype": "^1.17",
"symfony/polyfill-mbstring": "^1.17",
"symfony/polyfill-php80": "^1.17"
},