reza abbasi reza abbasi - 2 years ago 151
PHP Question

Using SimplePie feed parser in Laravel

I tried to use the SimplePie feed parser in Laravel. I pushed autoloader.php and library folder of SimplePie in the Laravel libraries folder, then I added a map for SimplePie in start.php

// folder tree

  • libraries/

    • simple/

      • library/

        • SimplePie/

        • SimplePie.php

      • autoloader.php

// start.php map

'Base_Controller' => path('app').'controllers/base.php',
'SimplePie' => path('app').'libraries/simple/autoloader.php',

// new object of simplepie

$feed = new SimplePie();

When I create a new object from SimplePie I see this error:


Autoloader not registered properly

I used this tutorial:

Answer Source

I'm not familiar with Laravel, but the SimplePie install instructions tell you to put the php and cache directories in the root.

"In your root directory, if they don't already exist, create two folders: php and cache."

Try putting them there instead of nested like you have them. The error message means that SimplePie can't find the class files, so it's a path issue. I would also just stick to the "php" directory instead of creating one called "simple". You might be able to change the directory names in SimplePie somewhere if you want to try and modify their code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download