4

When we built/install new module it should have registration.php as per Magento Standard.

When we run php bin/magento setup:upgrade. Module will be installed.

How actually this command check for my custom module's registration.php & install it?

1 Answer 1

6

For modules installed with composer, registration.php should be registered as autoload file in composer.json.

For local modules in "app" (which you seem to be referring to), there is app/etc/NonComposerComponentRegistration.php which itself is registered as autoloader file and looks for the following paths:

$pathList[] = dirname(__DIR__) . '/code/*/*/cli_commands.php';
$pathList[] = dirname(__DIR__) . '/code/*/*/registration.php';
$pathList[] = dirname(__DIR__) . '/design/*/*/*/registration.php';
$pathList[] = dirname(__DIR__) . '/i18n/*/*/registration.php';
$pathList[] = dirname(dirname(__DIR__)) . '/lib/internal/*/*/registration.php';
$pathList[] = dirname(dirname(__DIR__)) . '/lib/internal/*/*/*/registration.php';
4
  • Understand. So when NonComposerComponentRegistration.php called? & What will be flow while executing upgrade command? It checks what first?
    – Jackson
    Commented Sep 28, 2016 at 8:54
  • "which itself is registered as autoloader file" - this means, it is called via vendor/autoload.php, the autoloader generated by composer, on every request. Commented Sep 28, 2016 at 8:57
  • @AnkitShah when the autoloader is called so when app/bootstrap.php is called Commented Sep 28, 2016 at 8:57
  • @fschmengler Very Big Flow for Calling 1 to Another File Internally.
    – Jackson
    Commented Sep 28, 2016 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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