Table of Contents
回复内容:
Home Backend Development PHP Tutorial yii2和laravel哪个是未来?

yii2和laravel哪个是未来?

Jun 17, 2016 am 08:31 AM

从性能,速度,安全,可扩展性方面

回复内容:

很多技术问题并没有标准答案,也不要尝试得到标准答案,而要站在PHP程序员工作的角度来实际考虑。Yii和Laravel都是好的框架,没人说你必须只能选一个,好的PHP程序员是不需要太在乎用什么框架的,因为他们能短时间内拿起任何一个框架开始开发,并能很快地学到这个框架的设计思路,使用技巧。如果你要比较框架的一个或几个方面,这在网上有很多资料,不需要问,搜一下就有:

Suggestions for Technology stack choice : Laravel 5 vs Yii 2
Posts about Yii 2.0 vs. laravel on PHP Frameworks
Yii2 vs Laravel 5
quora.com/Yii-2-0-vs-La
Yii2 vs Laravel 5 : PHP

但不要期望找到标准答案,比较的目的是更好地去理解,而不是一锤子把某一个打死,那一定是偏颇的,你也会因此失去学习不同思路的机会。

技术是有品味问题的,也就是说不只是简单拿性能和扩展性来肯定或者否定,最重要的是使用的场景。一个框架适合某个团队项目的环境,但未必适合另一个,资深的技术人员都会认同这一点。

你应该自己去做功课,然后给出自己的答案,那样才是最能让自己信服的,别人的意见代替不了你对自己项目和团队的具体认识。 只能说说感受,Laravel5 是用过以后很难吐槽的一个框架,感觉很好! 性能,速度, 安全性及扩展性 ,这些都是yii的强项,laravel的强项是理念先进。yii本身也借鉴了很多laravel的理念,如ActiveRecord,当然,这点laravel本身也是借鉴了Ruby on rails.
yii唯一的缺点就是有点重,不轻量,不过他本身就是重量级框架。 I like Yii2. It is elegant and easy to extend to allow you develop enterprise website quickly. 蟹妖
虽然我认为这种选择其实更看猿粪,不过我还是遵从你的要求,帮你搜罗的一些材料。可能不能回答哪个是未来,不过希望能足以帮助你下定决心。其实学会了一个之后再跳也是OK的。

性能


我只找到一位仁兄的数据。仅“hello world” benchmark的话,yii2每秒 153 个requests VS laravel4 每秒 69 个。比较片面啊,仅供参考吧。等几个月可能最新一期的网络框架大跑分就会包含Yii2了,目前Laravel的成绩是“无法完成”,三个平台I7,亚马逊EC2,超大规模Peak,都失败了。PHP里面表现最好的只有鸟哥的yaf。不过说实话那个框架不太好用。

速度


有了性能,运行效率就不再考虑之内,所以考虑开发效率。总体而言,Yii2的卖点就是开箱即用,灵活扩展和易用性。这样而言,不能说Laravel4的开发效率就慢,只能说Yii2针对中大型项目开发有一些自己的考虑,提供了很多工具,涵盖了从搭建脚手架,开发调试,单元测试,功能测试,验收测试到性能调优。Laravel4的优势也是很强的,他非常受欢迎,有很多人一窝蜂地冲进Laravel的怀抱,所以无论中文还是英文的资料都很多。另一点是,Laravel的学习曲线很短,而Yii2入门容易,精通不易,且学且珍惜。我对Laravel的唯一意见是,这个鬼佬给应用组件起名字的时候,总是诗兴大发,起一些稀奇古怪望文不能生意的名字,让非英语母语的开发者很不爽。而 Yii2 的主要开发者一个中国人,一个德国人,一个毛子,都不是喜欢飚英语的。

安全


每个框架都宣称自己很安全,具体谁知道呢……这方面不是专家,只知道很多大型企业喜欢原先用 Yii,而 Yii2 更是经过几位国际知名的安全大师开过光的(审阅代码和重新功能)。

可扩展性


可扩展性都不错,Laravel 继承了 Symfony2 的 卓越解耦特性,Yii也在 Yii2 里全面拥抱了Composer,Dependency inversion,Service Locater等功能特色。大家都挺灵活的,这年头不支持DI都不好意思说自己是现代框架。为了解释他们之间细微的区别,这里着重说一下Symfony2,它默认给你N多选择,从一开始的程序设定开始就尽可能以后期灵活性为要,优点是几乎没有啥绑定会让你无所适从,不过选择太多,需要配置的地方太多,有时候本身就很容易让新人无所适从。而Yii2根据开箱即用原则,给你了很多默认选项,这些东西有时候会让你觉得不咋灵活,但是其实后期都可以调整的。这方面这几款框架都很灵活,区别只存在于设计思路方面。

总结

我觉得都可以是未来,抖个机灵的话,Laravel4和Yii2都不是未来,因为作者正在策划制作Laravel5和Yii 2.1。

利益相关,Yii2中文化项目发起人。软广告:Yii Framework 2.0 Chinese Documentation 没错 laravel是很好。然并卵,没有公司用,再好也是屁。还是选择YII laravel是不是未来我不知道,但是,我知道laravel版本更新太频繁,5.2.20到5.2.32就很多不兼容,同样的代码在前者下可以运行,在后者就各种报错。还有,性能上是有点跟不上。
yii2用过,还不错,虽然有很多自己的规定,初学者会不习惯,但是用惯了会发现,开发速度真快,而且各种适合大团队开发,缓存做得很细很强大,就是为大项目生的。
总结起来,laravel逼格高,貌似很先进,也许会是未来,但还是再过两年讨论谁是未来吧 真笨 你可以2个都学呀 yii2完爆laravel。
就代码审查方面,把yii和laravel都放到phpstorm中 laravel还是有个别警告的,而yii几乎没有。这就意味着ide都能识别得了整个系统的来龙去脉。所以使用者更加容易知道 用的类和方法从来里来的,在哪里用过多少次。 极大的方便了后期的维护refacter。 就开发速度,laravlel5 和yii 差太远了.
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 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)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Framework Security Features: Protecting against vulnerabilities. Framework Security Features: Protecting against vulnerabilities. Mar 28, 2025 pm 05:11 PM

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

See all articles