use zend framework 2/3 component's outside zf app

[亡魂溺海] 提交于 2019-12-12 03:39:57

问题


I am trying to use some zend framework components outside of zend framework but I am unable to do so.

Here is my composer file.

{
  "require": {
      "zendframework/zend-authentication": "^2.5.3"
   },
   "autoload": {
       "psr-4": {
          "Zend\\Authentication\\": ""
       }
   }
}

I was able to run composer update and install which has generated the autoload.php.

But when I try to use a the component I get "Fatal error: Class 'Zend\Authentication\Storage\Session' not found"

$session = new \Zend\Authentication\Storage\Session();

Is there anything obvious that I am missing from my setup?


回答1:


I needed to require the autoloader

require __DIR__ . '/../vendor/autoload.php';

problem now solved



来源:https://stackoverflow.com/questions/42070396/use-zend-framework-2-3-components-outside-zf-app

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