简体   繁体   English

如何在没有Composer的情况下安装ZF2组件

[英]How to install ZF2 component without Composer

I have tried to install both ZendPdf and TCPDF into ZF2 using Composer without success. 我尝试使用Composer将ZendPdf和TCPDF都安装到ZF2中,但没有成功。
Software is installed and autoload files are written but nothing works, ZF can't see them. 已安装软件并写入了自动加载文件,但没有任何效果,ZF无法看到它们。

Which files do I need to edit in order to manually install TCPDF library so that it autoloads? 为了手动安装TCPDF库以便自动加载,我需要编辑哪些文件?
I have found lots of similar questions in StackOverflow but not many working answers that don't involve Composer. 我在StackOverflow中发现了许多类似的问题,但没有涉及Composer的许多有效答案。

In fact, you don't install them without Composer. 实际上,如果没有Composer,就不会安装它们。 I think it is easier to make Composer work than to install them by hand. 我认为使Composer工作比手动安装要容易得多。

In theory you could install them by hand. 从理论上讲,您可以手动安装它们。 Just download both components in a version you like. 只需下载您喜欢的版本中的两个组件即可。 Then look into their composer.json file if you need to download some more software these libs need. 然后,如果需要下载这些库需要的其他软件,请查看其composer.json文件。 Download them as well. 也下载它们。 Have a look in their composer.json to download even more software. 看看他们的composer.json以下载更多软件。

After these downloads, unpack the packages, create a whole directory tree of files, and create the autoloading manually. 这些下载之后,请解压缩软件包,创建整个文件目录树,然后手动创建自动加载。 Which means again you have to look at all the composer.json files for the definition of autoloading. 这再次意味着您必须查看所有composer.json文件以了解自动加载的定义。 You are lucky if you find PSR-0 or PSR-4 autoloading, and you have to manually scan EVERY file in the directory if you have classmap autoloading. 如果发现PSR-0或PSR-4自动加载,很幸运,如果您具有classmap自动加载功能,则必须手动扫描目录中的每个文件。

You then simply push all these definitions into your own autoloader and hope it works. 然后,您只需将所有这些定义放入您自己的自动加载器中,并希望它可以工作。

Done. 做完了 That was easy... NOT! 那很容易……不是!

I can help you get Composer to work, but I cannot help you NOT use Composer. 我可以帮助您使Composer正常工作,但是我不能帮助您不使用Composer。 Ask a new question describing your problem using Composer. 提出一个新问题,以描述使用Composer的问题。

Please follow these instruction below to install Zend without composer. 请按照以下说明在没有作曲家的情况下安装Zend。 But I recommend to use composer for future consistency 但是我建议使用作曲家以确保将来的一致性

  1. Download latest stable copy of ZF2 from http://framework.zend.com/downloads/latest and unpack, we call it "ZF2" http://framework.zend.com/downloads/latest下载最新的ZF2稳定副本并解压缩,我们将其称为“ ZF2”
  2. Download latest stable copy of ZF2 skeleton app from https://github.com/zendframework/ZendSkeletonApplication/ and unpack, we call it ZF2Skeleton https://github.com/zendframework/ZendSkeletonApplication/下载ZF2骨架应用程序的最新稳定副本,然后解压缩,我们将其称为ZF2Skeleton
  3. Create folder like /vendor/ZF2 创建类似/ vendor / ZF2的文件夹
  4. Now copy ZF2/* into /vendor/ZF2 现在将ZF2 / *复制到/ vendor / ZF2
  5. Now you need to fix ZF2_PATH or $zf2Path variable at “/init_autoloader.php” file of root to point our “/vendor/ZF2” folder. 现在,您需要在根目录的“ /init_autoloader.php”文件中修复ZF2_PATH或$ zf2Path变量,以指向我们的“ / vendor / ZF2”文件夹。 Find "$zf2Path = false;" 找到“ $ zf2Path = false;” line into "/init_autoloader.php" file and replace it by "$zf2Path = 'vendor/ZF2/library';" 行到“ /init_autoloader.php”文件中,并替换为“ $ zf2Path ='vendor / ZF2 / library';”

That's all. 就这样。 You may visit https://shkhan.wordpress.com/2014/04/26/install-zend-framework-2-into-windows-iis/ for more information about installing ZF2 without composer. 您可以访问https://shkhan.wordpress.com/2014/04/26/install-zend-framework-2-into-windows-iis/了解有关在没有作曲家的情况下安装ZF2的更多信息。

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

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