Home php教程 php手册 Zend Framework 2.0 (zf2) 正式版发布及新功能介绍

Zend Framework 2.0 (zf2) 正式版发布及新功能介绍

Jun 06, 2016 pm 08:07 PM
framework zend release formal edition

著名php开源框架 Zend Framework 经历了长达数年的开发,终于在2012年9月5日正式发布了2.0版本,下简称ZF2。时隔Zend 1.0版本的发布已经有5年之久。 php的框架一直都是百家争鸣的,但是作为php官方运维的框架, Zend Framework 在php开发者中的流行度并不高

著名php开源框架Zend Framework经历了长达数年的开发,终于在2012年9月5日正式发布了2.0版本,下简称ZF2。时隔Zend 1.0版本的发布已经有5年之久。php的框架一直都是百家争鸣的,但是作为php官方运维的框架,Zend Framework在php开发者中的流行度并不高。其一是由于Zend Framework主要面向大型应用,对代码规范以及程序结构有严格的规定,入门门槛较高。另一方面还是因为Zend Framework整体的执行效率偏低,略显笨重。 所以Zend小组本次可谓痛定思痛,ZF2并不像其他框架只是修修补补的更新,而是完全重写了ZF1的所有代码,主打的口号就是“高性能”。

来看一看ZF2都带开了哪些新的特性:

1. 模块化(ModuleManager)
比起ZF1来说,ZF2原生支持模块的概念,任意第三方php程序,只要遵循Zend的编码规范和代码结构,都可以变成一个Zend模块。目前已经有一批试验阶段的模块出炉(参看ZF2 Modules)。 其中不乏像Doctrine ORM这样优秀的项目。

可以预见的是,随着ZF2的慢慢成熟,越来越多可以选择的模块将大量涌现,可能未来基于ZF2的项目开发,会像搭积木一样轻松简单。

2. 事件驱动(EventManager)

传统程序中,代码都是按线性顺序执行的,所以开发中往往很难将一些功能独立为一个组件或模块。

事件驱动,或者也可以叫钩子(Hook),改变了普通程序流程化的运行方式,应用了事件驱动之后,程序将呈现“注册事件” => “触发事件”的跳跃式运行,可以在不影响原有程序代码的,很容易的在任意位置加入新的业务逻辑,让项目的开发变得极为灵活。

3. 服务管理器(ServiceManager)

服务管理器的概念来自于”服务定位模式(Service locator pattern)”的编程思想。这种思想提倡将程序中的每一个独立功能提取出来作为一个“服务”,每一个服务都是独立可唤醒的,只有服务被调用时,服务相关的程序才会启动。

这也就是ZF2性能提升的秘密所在,ZF2的MVC启动流程中无处不体现ServiceLocator的思想,功能模块的调用极为“吝啬”,想必会给以前对Zend性能有意见的开发者一个大大的惊喜。

4. 依赖注入(Di Dependency Injection)

依赖注入广泛应用于Java的主流框架中,可以很好的解除大型应用中的耦合。ZF2引入Di也经过了反复的考量和权衡,即使进入beta阶段,Di仍然一度作为ZF2的基本实现方案,整个Mvc的配置基于Di。最终为了避免陷入Di可能造成的元数据式编程泥潭(Metaprogramming), Di只是作为ZF2的底层实现,上层加入了ServiceManager。普通开发者在使用ZF2的过程中不需要接触到Di的层面。不过这并不妨碍DI作为一个优秀的php组件存在并发挥作用。

5. 社会化编程

ZF2的代码完全托管在Github,借助Github的优秀设计,任何人都可以轻松的通过fork参与ZF2的项目建设,甚至提交新的模块功能。笔者AlloVince也帮助Zend小组修复了一些BUG,发现Zend小组响应非常快(从没有超过24小时),对反馈的意见也会花时间认真解答。所以参与ZF2项目是参与php开源项目一个不错的选择。

总结

正如ZF2发布信息中写到的,没有哪个框架是完美的,ZF2也不例外。所以作为开发者要做的,不应该是纠结于哪个框架好哪个框架不好这种永远也得不到结论的问题,而是针对不同的项目选择合适的框架。

在现阶段,开发大中型php应用,特别是商业应用和企业应用,ZF2是一个非常不错的选择,因为ZF2有严格代码规范,非常适合团队开发。而ZF2作为Zend官方的支持产品,整体的可靠性和BUG的响应速度也都是有保证的。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to publish works on Xiaohongshu How to publish articles and pictures on Xiaohongshu How to publish works on Xiaohongshu How to publish articles and pictures on Xiaohongshu Mar 22, 2024 pm 09:21 PM

You can view various contents on Xiaohongshu, which can provide you with various help and help you discover a better life. If you have anything you want to share, you can post it here so that everyone can take a look. , and at the same time, it can bring you profits. It is very cost-effective. If you don’t know how to publish your works here, you can check out the tutorial. You can use this software every day and publish various contents to help everyone use it better. Don’t miss it if you need it! 1. Open Xiaohongshu and click the plus icon below. 2. There are [Video] [Picture] [Live Picture] options here; select the content you want to publish and click to check. 3. Select [Next] on the content editing page. 4. Enter the text content you want to publish and click [Publish Pen]

Why can't Xiaohongshu publish videos of works? How does it publish its work? Why can't Xiaohongshu publish videos of works? How does it publish its work? Mar 21, 2024 pm 06:36 PM

With the rapid development of social media, short video platforms have become the main channel for many users to express themselves and share their lives. Many users may encounter various problems when publishing videos of their works on Xiaohongshu. This article will discuss the reasons that may cause the video publishing of Xiaohongshu works to fail and provide the correct publishing method. 1. Why can’t Xiaohongshu publish videos of works? The Xiaohongshu platform may occasionally experience system failures, which may be caused by system maintenance or upgrades. In this case, users may encounter the problem of being unable to publish videos of their works. Users need to wait patiently for the platform to return to normal before trying to publish. An unstable or slow network connection may prevent users from posting videos of their work on Xiaohongshu. Users should confirm their network environment to ensure that the connection is stable and

Why can't Xiaohongshu be released? What should I do if the content published by Xiaohongshu cannot be displayed? Why can't Xiaohongshu be released? What should I do if the content published by Xiaohongshu cannot be displayed? Mar 21, 2024 pm 07:47 PM

As a lifestyle sharing platform, Xiaohongshu has attracted a large number of users to share their daily life and grow products. Many users have reported that their published content cannot be displayed. What is going on? This article will analyze the possible reasons why Xiaohongshu cannot be released and provide solutions. 1. Why can’t Xiaohongshu be released? Xiaohongshu implements strict community guidelines and has zero tolerance for publishing advertisements, spam, vulgar content, etc. If the user's content violates the regulations, the system will block it and the content will not be displayed. Xiaohongshu requires users to publish high-quality and valuable content, and the content needs to be unique and innovative. If the content is too generic and lacks innovation, it may not pass review and therefore not be displayed on the platform. 3. Account abnormality

How to delete Xiaohongshu releases? How to recover after deletion? How to delete Xiaohongshu releases? How to recover after deletion? Mar 21, 2024 pm 05:10 PM

As a popular social e-commerce platform, Xiaohongshu has attracted a large number of users to share their daily life and shopping experiences. Sometimes we may inadvertently publish some inappropriate content, which needs to be deleted in time to better maintain our personal image or comply with platform regulations. 1. How to delete Xiaohongshu releases? 1. Log in to your Xiaohongshu account and enter your personal homepage. 2. At the bottom of the personal homepage, find the "My Creations" option and click to enter. 3. On the "My Creations" page, you can see all published content, including notes, videos, etc. 4. Find the content that needs to be deleted and click the "..." button on the right. 5. In the pop-up menu, select the "Delete" option. 6. After confirming the deletion, the content will disappear from your personal homepage and public page.

How to publish works on Xiaohongshu app? Tutorial on publishing works on Xiaohongshu app in five minutes How to publish works on Xiaohongshu app? Tutorial on publishing works on Xiaohongshu app in five minutes Mar 12, 2024 pm 05:10 PM

How does the Xiaohongshu app publish works? Many friends know that there are a large number of creative works and a strong dating circle in this software. For users who are new to this software, they probably don’t know how to publish their works, so that more people can watch the other side of you. If you still don’t know how to publish the works in it, then quickly refer to the five-minute tutorial on publishing works on the Xiaohongshu app recommended by the editor of this site. Tutorial on publishing works in Xiaohongshu app in five minutes 1. Click [Three] As shown in the picture, click [Three] pointed by the red arrow in the upper left corner. 2. Click [Creation Center] As shown in the picture, click [Creation Center] pointed by the red arrow. 3. Click [Go to Publish] as shown in the picture,

When is the best time to publish Xiaohongshu? Where does it post the most traffic recommendations from? When is the best time to publish Xiaohongshu? Where does it post the most traffic recommendations from? Mar 21, 2024 pm 08:11 PM

In today's social network era, Xiaohongshu has become an important platform for young people to share their lives and obtain information. Many users hope to attract more attention and traffic by publishing content on Xiaohongshu. So, when is the best time to post content? This article will explore in detail the selection of Xiaohongshu’s publishing time and the publishing location with the most traffic recommendations. 1. When is the best time to publish Xiaohongshu? The best time to publish content on Xiaohongshu is usually during periods of high user activity. According to the characteristics and behavioral habits of Xiaohongshu users, there are several time periods that are more appropriate. During the time period from 7 pm to 9 pm, most users have returned home from get off work and started browsing content on their mobile phones in search of relaxation and entertainment. Therefore, content posted during this period is more likely to attract users

How to publish Xiaohongshu video works? What should I pay attention to when posting videos? How to publish Xiaohongshu video works? What should I pay attention to when posting videos? Mar 23, 2024 pm 08:50 PM

With the rise of short video platforms, Xiaohongshu has become a platform for many people to share their lives, express themselves, and gain traffic. On this platform, publishing video works is a very popular way of interaction. So, how to publish Xiaohongshu video works? 1. How to publish Xiaohongshu video works? First, make sure you have a video content ready to share. You can use your mobile phone or other camera equipment to shoot, but you need to pay attention to the image quality and sound clarity. 2. Edit the video: In order to make the work more attractive, you can edit the video. You can use professional video editing software, such as Douyin, Kuaishou, etc., to add filters, music, subtitles and other elements. 3. Choose a cover: The cover is the key to attracting users to click. Choose a clear and interesting picture as the cover to attract users to click on it.

How to publish works on Douyin How to publish works How to publish works on Douyin How to publish works Mar 13, 2024 am 08:10 AM

We all know that when browsing the platform, there will be many videos recommended to us. These are basically a way of recording a good life. Of course, we can also publish some of our usual video works on it. Or photo albums, etc. are all possible, some talent shows, etc. are all possible. Maybe you can gain more fans. It is really suitable for you to use, but many users may not I don’t know how to publish the work after using it once, so today I will give you a detailed explanation of some of the above steps and methods for publishing, so that you can have a better understanding of it, if you also like it , just take a look with the editor, I believe you will like it.

See all articles