Add external libraries to Symfony2 project

前端 未结 2 720
忘了有多久
忘了有多久 2021-02-09 20:41

I am trying to add an external library (PHP Simple DOM Parser, http://simplehtmldom.sourceforge.net/index.htm) to a Symfony2 project. I took a tutorial that explains how to incl

2条回答
  •  礼貌的吻别
    2021-02-09 21:12

    I'm new to Symfony2 but as i can see, you are not respecting the PSR for autoloader.

    I'm presumable thinking you should do:

    # /vendor/phpsimpledom/lib/Phpsimpledom/Phpsimpledom.php
    
    require_once __DIR__.'/src/simple_html_dom.php';
    
    class Phpsimpledom_Phpsimpledom extends simple_html_dom_node {
    
    }
    

    Note that the correct filename would be /vendor/phpsimpledom/lib/Phpsimpledom/Phpsimpledom.php as the call must include the namespace to work.

    Hope it works now.

提交回复
热议问题