0

I am of the opinion that using require_once in registration.php is not ok and possibly against Magento coding standards.

Am I right or wrong?

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_Module',
    __DIR__
);

require_once(BP.'/lib/internal/SomeModule/src/somemodule/autoload.php');

1 Answer 1

0

You should use composer require the package you want.

For example: install aws-sdk for magento

composer require aws/aws-sdk-php

For your custom extension, you can edit to your composer.json for other people to use.

3
  • Thanks for reply. It's not a custom extension, but rather a bunch of classes and libraries, and only for private use. Are you saying we should convert it to a custom extension and install it via composer, which will then make sure everything is autoloaded? Commented Dec 21, 2022 at 0:04
  • @MichaelMussulis Yes, I think that converting to a custom extension or libraries of composer
    – rangerz
    Commented Dec 21, 2022 at 15:51
  • 1
    it worked. Thanks for the advice. Commented Dec 29, 2022 at 16:26

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.