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:

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": [
        ,"xml conversion"
        ,"array conversion"
    ,"authors": [
             "name":        "Bryan Tong"
            ,"email":       "contact@nullivex.com"
            ,"homepage":    "http://bryantong.com"
             "name":        "Tony Butler"
            ,"email":       "spudz76@gmail.com"
            ,"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.

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

Try use LSS\Array2XML;

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

"autoload": {
        "psr-0": {
            "LSS": ""
  • Perfect! Thank you. – sulman Aug 9 '17 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.