Is there a new integration or workaround for getting latest SimplePie RSS/ATOM parser/generator running in CakePHP 4.x?
Of course cakephp has the xml dataview, but there is more in feed parsing and delivering…
There were several plugins for that integration, but they are up to 14 years old. So the question would be, how to integrate an external library, that is installable via composer under /vendor but not directly loadable as a plugin?
ok, maybe easier than i thought. Probably it was just:
in Application.php bootstrap function:
require 'vendor/simplepie/simplepie/autoloader.php';
and in the Controller:
use SimplePie;
Generally with any composer installed module you don’t need to manually require any PHP files yourself.
Thats what PSR-4 autoloading via namespaces does for you automatically (see PSR-4: Autoloader - PHP-FIG)
So you shouldn’t need the require 'vendor/simplepie/simplepie/autoloader.php';
inside your Application.php
just keep the use SimplePie;
inside your controller and everything should be fine.
1 Like
Ok, perfect, that’s it.
Coming from the trial of loading it as a plugin, the first adaption that succeeded was the require statement. And cake didn’t complain about that…
Thank you!