5

I am used to Magento 1.x, now It's really confusing to understand the Magento 2.0.x structure.

I am trying to do it. Please help me to understand what is the function of the following folders below vender (Except magento folder)

( bin, braintree, composer, doctrine, fabpot, justinrainbow, league, lusitanian, monolog, oyejorge, pdepend, pelago, phpmd, phpseclib, phpunit, psr, sebastian, seld, sjparkinson, squizlabs, symfony, tedivm, tubalmartin, zendframework )

Is that related to our development? Or those are just some Library files, which need to be keep there?

2

These PHP libraries are installed as external dependencies via composer and fall into three categories

  1. libraries that Magento uses. For example: zendframework, monolog, braintree
  2. libraries that the Magento development tools use (bin/magento, the test framework). For example: phpunit, pdepend, phpmd, symfony
  3. libraries that composer itself uses. For example: composer, justinrainbow, symfony (yes, again. The symfony console)

"composer" also contains the PSR-4 autoloader generated by composer (autoload.php).

"bin" is special, as it is not a library on its own but contains symlinks to executable scripts from the dependencies (like "phpunit")

| improve this answer | |
1

The files under the vendor folder are really important as they are part of the software.

If you check the app/autoload.php file you can see the following code:

$vendorDir = require BP . '/app/etc/vendor_path.php';
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";

/* 'composer install' validation */
if (file_exists($vendorAutoload)) {
    $composerAutoloader = include $vendorAutoload;
} else {
    throw new \Exception(
        'Vendor autoload is not found. Please run \'composer install\' under application root directory.'
    );
}

That means the classes declared in the vendor folder are included to Magento via the autoloader.

For example, the logging system in Magento 2 uses the following interface \Psr\Log\LoggerInterface and that class is declared under vendor\psr\log\Psr\Log folder.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.