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
|
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. – snez Jul 5 '16 at 22:47
-
1
-
@snez How to add that file into registration.php, Let me code for that. – Hitesh Vaghasiya Aug 25 '17 at 9:09
-
Can you please advise on this magento.stackexchange.com/questions/310486/… ? – Hamendra Sunthwal Apr 16 '20 at 4:54
If this library use autoload.php, you should require this library via magento composer