8

I am creating a module that connects to a SOAP service, I have generated classes for this service using wsdl2phpgenerator which uses autoload.php. Placing this in "lib/" with the correct class namings makes it easy to include in Magento 1.9. How do I go about including these classes in Magento2?

2 Answers 2

1

This library should be shipped as a part of your custom module. Specify path to autoload.php of generated library in composer.json of your module. Should have something like this:

{
    ...
    "autoload": {
        "files": [
            "registration.php",
            "path-to-generated-soap-client-lib-autoload.php"
        ],
        ...
    }
}
4
  • 1
    This probably works for modules installed through the marketplace but not for modules installed by extracting them manually. Better to require the autoloader from inside registration.php.
    – snez
    Commented Jul 5, 2016 at 22:47
  • 1
    is it possible to detail the full process please?
    – Alexglvr
    Commented Apr 21, 2017 at 11:03
  • @snez How to add that file into registration.php, Let me code for that. Commented Aug 25, 2017 at 9:09
  • Can you please advise on this magento.stackexchange.com/questions/310486/… ? Commented Apr 16, 2020 at 4:54
1

If this library use autoload.php, you should require this library via magento composer

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.