简体   繁体   English

如何在不使用composer的情况下在zf3中安装模块?

[英]How can I install modules in zf3 without using composer?

How can we install modules in zend framework 3 manually?. 我们如何在zend Framework 3中手动安装模块? I mean without using composer how can we do that? 我的意思是不使用作曲家怎么办?

You will need a PSR-4 compatible autoloader (such as Aura Router or so on), which you'd need to include in public/index.php . 您将需要与PSR-4兼容的自动加载器(例如Aura Router等),您需要将其包括在public/index.php

Then download any modules you want, configure your autoloader, and good luck with your dependencies' dependencies... 然后下载所需的任何模块,配置自动加载器,并祝您依赖项的依赖项好运...


May I ask why you would rather not use Composer? 请问您为什么不愿意使用Composer?

Actually I am gonna use my application with shared hosting which doesn't support shell. 实际上,我将使用不支持Shell的共享托管应用程序。

So basically I am not aware of your deployment process, but I'd definitively use composer on my local system, then upload the vendor folder when deploying, however you do that. 因此,基本上我不知道您的部署过程,但是我一定会在本地系统上使用composer,然后在部署时上传vendor文件夹,但是您可以这样做。

If you're using a CI, then do your composer processing there. 如果您使用的是CI,请在此处进行作曲家处理。

I got a better solution. 我有一个更好的解决方案。 By editing 3 files we can add a module without using composer. 通过编辑3个文件,我们无需使用作曲家就可以添加模块。 1.modules.config.php in config folder Just add the module name in the return array. 1. config文件夹中的1.modules.config.php只需在返回数组中添加模块名称。 2. autoload_psr4.php in vendor/composer directory Add your module information to return array in following format 'Modulename\\' => array($modulepath), 3. autoload_static.php in vendor/composer directory Here we have to add the module information in two places 1. In $prefixLengthsPsr4 array as 'M' => array( 'Modulename\\' => 11, ), The key value indicates the first letter of module name and the numerical value is the length of modulename +1(for /). 2. vendor / composer目录中的autoload_psr4.php添加模块信息以以下格式返回模块'Modulename \\'=> array($ modulepath),3. vendor / composer目录中的autoload_static.php这里,我们必须添加模块信息在两个地方1.在$ prefixLengthsPsr4数组中,如'M'=> array('Modulename \\'=> 11,),键值指示模块名称的首字母,数值为模块名称+1的长度(对于/)。 2. In $prefixDirsPsr4 array as 'modulename\\' => array ( 0 => DIR . '/../..' . '/module/modulename/src', ), Its done.Thank you :-) 2.在$ prefixDirsPsr4数组中,将其作为'modulename \\'=> array(0 => DIR 。'/../ ..'。'/ module / modulename / src',),完成了。谢谢:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM