How to include multiple php libraries in Symfony?

ぐ巨炮叔叔 提交于 2019-12-06 05:55:54

Symfony's autoloader looks by default for your classes in the top-level <project>/lib directory. Any file in that directory or below (with the exception of "vendor") will be searched for classes. Symfony searches for any .php file with class declarations and adds them to the autoload system.

Additionally, you can add search paths in your application's autoload.yml file. For example, for one of my applications I've put a third-party Flickr library in <project>/vendor/phpFlickr, and my <project>/apps/frontend/config/autoload.yml file looks like:

autoload:
    vendor_php_flickr:
        path: %SF_LIB_DIR%/vendor/phpFlickr
        recursive: on

That allows all classes below .../vendor/phpFlickr to be autoloaded.

this is an alternative way, you can define/add to your preExecute this:

public function preExecute()
{
  $this->getContext()->getConfiguration()->loadHelpers('Foo', 'Bar');
}

taken from (http://oldforum.symfony-project.org/index.php/m/92916/)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!