search
HomeBackend DevelopmentPHP Tutorialyii2和laravel哪个是未来?

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

回复内容:

很多技术问题并没有标准答案,也不要尝试得到标准答案,而要站在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
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
Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

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

PHP Logging: Best Practices for PHP Log AnalysisPHP Logging: Best Practices for PHP Log AnalysisMar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

HTTP Method Verification in LaravelHTTP Method Verification in LaravelMar 05, 2025 pm 04:14 PM

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

Discover File Downloads in Laravel with Storage::downloadDiscover File Downloads in Laravel with Storage::downloadMar 06, 2025 am 02:22 AM

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

See all articles

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

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor