0

I have installed via composer the Array2XML package (composer require openlss/lib-array2xml). The package has installed correctly, but my question is how do I now use this in my module (observer)?

I have tried:

<?php 
use Openlss\Array2XML;
use Openlss\LSS\Array2XML;
use Openlss\Array2XML\Array2XML;
use Openlss\lib-array2xml\LSS\Array2XML; // this fails due to the hyphen
?>

(and just about every other combination I can think of!)

Each one of these fails with a class not found error.

This is how the package has installed:

enter image description here

This is the composer file that was generated:

{
     "name":                "openlss/lib-array2xml"
    ,"homepage":            "http://openlss.org"
    ,"description":         "Array2XML conversion library credit to lalit.org"
    ,"license":             "Apache-2.0"
    ,"type":                "library"
    ,"keywords": [
         "array"
        ,"xml"
        ,"xml conversion"
        ,"array conversion"
    ]
    ,"authors": [
         {
             "name":        "Bryan Tong"
            ,"email":       "[email protected]"
            ,"homepage":    "http://bryantong.com"
        }
        ,{
             "name":        "Tony Butler"
            ,"email":       "[email protected]"
            ,"homepage":    "http://openlss.org"
        }
    ]
    ,"require": {
        "php":  ">=5.3.2"
    }
    ,"autoload": {
        "psr-0": {
            "LSS": ""
        }
    }
}

I have tried clearing cache, setup:upgrade, deleting var/generation etc but nothing has worked. Using Magento 2.1.6

Any ideas? Thanks.

2
  • Try use LSS\Array2XML;
    – Nikolas
    Commented Aug 9, 2017 at 11:46
  • That's it! :) Thank you. Please add as an answer and I'll accept. Thank you.
    – sulman
    Commented Aug 9, 2017 at 11:59

1 Answer 1

0

Try use LSS\Array2XML;

You have defined the root folder as "LSS" in your composer.json file

"autoload": {
        "psr-0": {
            "LSS": ""
        }
    }
1
  • Perfect! Thank you.
    – sulman
    Commented Aug 9, 2017 at 12:23

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.