Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New to Laravel - Vendor directory

I followed all the steps from Laravel Installation guide.

Using Composer, the project is installed successfully on server and run like a charm.

On the installation, Composer add some dependencies in the vendor directory.

My question is: Why is there are so many dependencies for the "Hello World project". I don't understand the needs of directories. Heres the list:

  • bin
  • classpreloader
  • composer
  • d11wtq
  • filp
  • ircmaxell
  • jeremeamia
  • laravel
  • monolog
  • nesbot
  • nikic
  • paragonie
  • patchwork
  • phpseclib
  • predis
  • psr
  • stack
  • swiftmailer
  • symphony

I come from Zend development. So in the vendor directory, I was expecting only the framework Laravel, nothing else. Why would I need over 4200 files of 3rd party script.

Thanks for answering.

Carl

like image 255
SequenceDigitale.com Avatar asked Apr 11 '17 17:04

SequenceDigitale.com


People also ask

Where is vendor folder in Laravel?

The vendor is a subfolder in the Laravel root directory. It includes the Composer dependencies in the file autoload. php. Composer is a PHP based tool for dependency management.

How do I create a vendor folder?

The vendor folder is created by composer when you add PHPMailer to your own project (if you're *using* PHPMailer) or if you clone it and then run composer install (if you're *working on* PHPMailer itself). Please refer to the installation instructions in the readme, and composer's documentation.

What does the vendor directory contains in Laravel?

The vendor directory contains the composer dependencies, for example, to install Laravel setup, the composer is required. The vendor folder contains all the composer dependencies.


1 Answers

Laravel has many features out-of-the-box which are missing in other frameworks. I can understand that you think there are too many dependencies for something simple like a Hello World project, because you're completely right. But Laravel is not about adding features when you need them, it's about having all features already there. It's like comparing Arch Linux and Ubuntu. In Arch, you install things on the go when you need them. Ubuntu has everything out-of-the-box.

Which one is better is mostly a matter of taste.

I ran composer show --tree in a new Laravel project to see a dependency tree. Now, as of Laravel 5.4.18, there are 4 main dependencies which pull in all other dependencies.

  1. laravel/framework
  2. laravel/tinker
  3. fzaninotto/faker
  4. phpunit/phpunit

Many of these dependencies aren't in use when deployed, e.g. phpunit is only used for unit tests or the Symfony debug bar is used – well, you guessed it – for debugging.

Regarding your comment about removing dependencies: They are pulled in by one of the 4 main dependencies, so you have to either fork them and remove the unused components or live with it.

like image 177
mnme Avatar answered Oct 20 '22 05:10

mnme