1

I am trying to create an xml file using Orchestral/parser

https://github.com/orchestral/parser

I correctly installed it and called it like this in my Controller:

use Orchestra\Parser\Xml\Facade as XmlParser;

...

class Product extends Controller
{    
    public function createProduct()
   {
        $xml    = XmlParser::load("test.xml");
        $xmlR = $xml->parse([
            'id' => ['uses' => 'xmlR.id'],
        ]);
   }
}

But I get following error message:

ReflectionException in Container.php line 741: Class orchestra.parser.xml does not exist

Thus I do not really understand what load means(in my case load("test.xml").

nyedidikeke
  • 6,899
  • 7
  • 44
  • 59
John Does Legacy
  • 1,441
  • 6
  • 23
  • 33

3 Answers3

2

Did you try to refresh the autoload with command: composer dump-autoload

muchacho
  • 393
  • 5
  • 7
1

Your error clearly points that you did not set up the package in your config/app.php file (by listing the provider for the Orchestral XML Parser).

To resolve it, do add Orchestra\Parser\XmlServiceProvider::class to the list of providers in your config/app.php file as illustrated below:

'providers' => [

// Other Laravel service providers

Orchestra\Parser\XmlServiceProvider::class,

],

nyedidikeke
  • 6,899
  • 7
  • 44
  • 59
0

clearing the cache fixed my problem:

php artisan cache:clear
php artisan config:cache
Lode Alaert
  • 671
  • 6
  • 6