## php – How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?

Question

In a plugin I am currently coding, I want to use the Simple HTML DOM Parser library. However, when I include it

require(CPS_PLUGIN_PATH . '/vendor/simple_html_dom.php');


I get this error:

Fatal error: Cannot redeclare file_get_html() (previously declared in /www/htdocs/12345/mydomain.com/wp-content/plugins/custom-post-snippets/vendor/simple_html_dom.php:48) in /www/htdocs/12345/mydomain.com/wp-content/plugins/fast-velocity-minify/libs/simplehtmldom/simple_html_dom.php on line 54


So obviously the Fast Velocity Minify plugin is already using it. What do I do here, if I don’t want to mess around in the library itself? What’s the best practice in a case like this?

0
1 year 2022-01-31T20:37:32-05:00 0 Answers 0 views 0