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?
Add a comment
|
2 Answers
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"
],
...
}
}
-
1This 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.– snezCommented Jul 5, 2016 at 22:47
-
1
-
@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
If this library use autoload.php, you should require this library via magento composer