简体   繁体   English

什么是Zend Expressive和Zend MVC?

[英]What is Zend Expressive and Zend MVC?

I am starting a new project in PHP and wanted to choose the latest ZendFramework. 我正在用PHP启动一个新项目,并想选择最新的ZendFramework。 I see that Zend Framework 3 has been released so I wanted to start with Zend Framework 3 itself. 我看到Zend Framework 3已经发布,所以我想从Zend Framework 3本身开始。 But when I go to the INSTALL page of Zend, they have given options as Zend MVC and Zend expressive. 但是当我转到Zend的安装页面时,他们给出了Zend MVC和Zend富有表现力的选项。

I read about them and have an understanding that Expressive is a microframework while MVC is a full-stack framework. 我了解了它们,并了解Expressive是一个微框架,而MVC是一个全栈框架。 Apart from this I am not very clear about them. 除此之外,我对它们还不是很清楚。

I see that Zend MVC was also there for ZF2 and the documentation says MVC as a layer. 我看到Zend MVC也可以用于ZF2,并且文档说MVC是一个层。 I could not find Expressive for zf2 though. 我找不到zf2的Expressive。

Question: 题:

  1. Are both Zend MVC and Zend Expressive packages? Zend MVC和Zend Expressive软件包都是吗? and are part of zf3? 并且是zf3的一部分?
  2. When I see the installed packages in Zend MVC and Zend Expressive, I don't see a package for Zend framework, but I see separate packages for Zend Components such as zend-http , zend-json , etc. So are these (expressive and MVC) just built over different Zend components? 当我在Zend MVC和Zend Expressive中看到已安装的软件包时,没有看到Zend框架的软件包,但是看到了Zend组件的单独软件包,例如zend-httpzend-json等。这些(表达性和MVC)只是建立在不同的Zend组件之上?
  3. How do I know that I am using ZF3? 我怎么知道我正在使用ZF3?

Are both Zend MVC and Zend Expressive packages? Zend MVC和Zend Expressive软件包都是吗? and are part of zf3? 并且是zf3的一部分?

This depends a bit on your definition of "packages". 这有点取决于您对“包装”的定义。 Zend Expressive is not part of ZF3, it is a microframework alternative to ZF3. Zend Expressive不是ZF3的一部分,它是ZF3的微框架替代品。 Zend MVC and Zend Expressive are both packages, and they also depend on other packages. Zend MVC和Zend Expressive都是软件包,它们还依赖于其他软件包。 ZF3 is what is known as a "meta package", which means it doesn't have any code of its own, it is soley a collection of other packages. ZF3是所谓的“元软件包”,这意味着它没有自己的任何代码,它只是其他软件包的集合。 The ZF3 meta package includes the Zend MVC package. ZF3元软件包包括Zend MVC软件包。

are these (expressive and MVC) just built over different Zend components? 这些(富有表现力的和MVC的)只是建立在不同的Zend组件之上吗?

Yes, and there is quite a bit of overlap. 是的,并且有很多重叠之处。

How do I know that I am using ZF3? 我怎么知道我正在使用ZF3?

This is more a question of semantics. 这更多是一个语义问题。 If you have the Zend Framework meta package installed, that's ZF3. 如果您安装了Zend Framework元软件包,则为ZF3。 If you were just using the MVC package, you could argue that's still ZF3. 如果您只是在使用MVC软件包,您可能会说仍然是ZF3。 If you are using Expressive, that's something else. 如果您使用的是Expressive,那就另当别论了。

The line between ZF3 and Expressive (and when you would use one over the other) is somewhat fuzzy. ZF3和Expressive之间的界线(以及您何时将其用于另一种界线)有些模糊。 This discussion may help you. 此讨论可能会对您有所帮助。

In an earlier edit you asked which you should use to create a REST API. 在先前的编辑中,您询问应使用哪个来创建REST API。 You could do that with either. 您可以使用任一方法。

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

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