最好的 PHP 框架是什么?为什么?
回复内容:
------------------- 更新于: 2014 . 09. 02 ------------------Laravel China is ready Laravel 中文文档 , 欢迎发起 issue 提交纰漏 和建议 --> Laravel China · GitHub
------------------- 更新于: 2014 . 08. 17 ------------------
PHPhub - PHP & Laravel的中文社区 一个干净的 PHP 中文社区一直是我的梦想, 这几天动手写了一个, 今天算是正式上线, 虽然还有好多功能需要优化, 欢迎大家加入, 给我点动力, 哈哈.
使用 Laravel4 编写的, 代码也是开源的 summerblue/phphub · GitHub
------------------- 更新于: 2014 . 03. 06 ------------------
一个比较有说服力的数据:
Laravel 是 Github 上最有名的 PHP 项目, 8627 个 star, 领先第二名的 Symfony 和 第三名的 CI 接近 1000个 star, 见这里 --> Most Star PHP Project On GitHub
ci 和 symfony 得话多少年才能达到今天的影响力, 而 Laravel 的第一个 commit 发生于 Jun 09, 2011 , 见下图:

---------------- 首次发布 ---------------------
Laravel4 , 整个 PHP 社区都为之疯狂的框架.
Laravel4 讲究的是最佳实践, 是一个积极向上的框架, 向 牛B 的 Rails 看齐, 借鉴了很多在成熟框架已经体现出来很成功的元素:
- RESTful Routing ;
- 设计精妙的 Blade 模板引擎, 轻快, 不失灵活 ;
- 合理的 ORM model 层, Eloquent ORM , 借鉴于 Rails 的成功;
- migration 数据库版本系统 和 seeding ;
- 使用包管理器 Composer , 打开了一扇开往春天的门;
- 强调测试驱动, 整个核心经受过完整的测试, 高质量的代码;
- 命令行驱动, 可以做到高度自动化 (讲究效率, 代码生成器...) , 借鉴与 rails ;
- 合理使用 PHP 的新版本特性, 让写代码更加有乐趣, 跟上时代的步伐;
- 积极向上的社区, 这个很重要呀, 大家都在学习着, 创造着好的工具, 加快开发速度, 提高编程效率, 接受新知识的速度也很快.
- 对 php 标准化的支持 PHP-FIG — PHP Framework Interop Group
另: 以下几个链接供参考
Best PHP Frameworks for 2014
Why Laravel is Taking the PHP Community by Storm
The future of web development is Laravel
2014 我有个愿望, 希望 PHP 社区一盘散沙的局面成为过去, Laravel, Composer, PHP-Fig 才是未来, 快速开发, 遵守规范, DRY, 构建一个团结的社区, 聪明, 理智的社区.
没有一个比现在更合适的时间了, 朋友们, 把我顶起来吧, 让 PHP 的新人和老鸟都知道在 PHP 社区里面, 有这么一个好东西的存在, 也算为 PHP 社区做贡献. May God be with You.
------------------------------------- END ------------------------------------- 首推 Laravel ,其次是 Yii,Laravel 的设计思想以及在工程实践上的支持,超过 ThinkPHP 好几个世代。如果说原生的 PHP 是火枪, ThinkPHP 就是来福枪,Lavavel 则是冲锋枪。你要打猎的话,带把来福枪完全足够了,但是要上战场,非得更自动化的冲锋枪不行。
好处有很多啊:
- Composer 做包管理
- 标准的 Autoload 实现,可以让 `include xxx.php` 成为历史
- 各种依赖注入
- ORM 支持
- 好用的命令行和脚手架
- 丰富的文档和活跃的社区
说ThinkPHP适合国人使用的人,自黑的时候不要带上别人,多谢。 在PHP5.3之后,PHP-FIG和Composer给PHP社区带来了巨大的变化,如果一个框架还没用到Composer,还是invent everything here,就真的有点落伍了。
有了Composer的支持,像攒电脑一样实现一个自己的框架也不是多困难的事儿了,但是要做出一个“好”框架还是挺困难的一件事。项目用过的框架6个(ZF1,SF2,CI,Yii,Laravel4,Silex),了解过的就不数了,见过的框架中最优秀的当属Laravel4,解释如下:
- 直接。各种常用的功能都由一些简单的Service实现,通过Facade访问,很多常见的问题都简单优雅的处理了,接口设计很贴心,大部分使用场景都替你考虑到了。由于功能简单直接,文档也就无需赘言,官网上的文档也不是太多,看一遍完全可以开始干活儿。
- 开放。有了Composer,优秀的代码可以很方便的引入项目,Laravel的框架就用到了boris,whoops,monolog,swiftmailer和symfony下面的一批基础类库,而不是非得自己写的代码才放心。
- 简单。不只是使用上的简单,框架本身的实现也不像别的“企业级”框架那么沉重,各个功能见很少的耦合,通过依赖注入容器组装起来。要从源代码里挖掘框架内部的实现也没有那么多抽象层级。
另外,PHP新手还是从PHP The Right Way开始学吧,对新时代的PHP有个正确的认识,CI适合的是还在用
如何你想要更好的框架,PHP满足不了你,用rails吧。 不是萬金油的回答, 但是真的沒有最好, 只有最合用。
框架分四種:
1. [把文件層先脫離出來就是大一步了]的Minimalist 系: Slim/KissMVC => 都差不多
2. [把輪子通通拿來給本大爺用的]功能齊全大庫系: Yii, CI, Cake 等 =>Yii 比較好
3. [不能高級一點嗎?]的安裝擴展系: Laravel, ZF => Laravel 比較好
4. [速度最實際]的C 系: Yaf, Phalcon => Phalcon 比較豐富 和大家一样,论强大推荐Yii。
- yii框架是首选,文档齐全,面向对象很彻底,性能超群。实例化模型以后很多组件都能用上,唯一不喜欢的是查询出来的数据操作都是对象式的,我还是比较喜欢数组方式,只好用chtml::listData()转化。另zii wigdet对于提高开发速度非常牛逼。
- 其实thinkphp 3真的很不错,而且容易上手,文档更全更适合国人。我个人比较喜欢thinkphp的db部分和route rest部分。
- zend framework 更加像一个超大超全的类库,虽然运行速度有点慢,很多框架都留有zend类的接口,其价值可见一斑
- codeigniter没仔细看,不敢妄言,中文支持比较少,很多人用的是他的分支版,kohana,有兴趣的话可以看下。
- 最后说一下speedphp,这个框架的设计思想我很喜欢,简单高效,有sae版,扩展方便,适合改造,速度也不错,我开发社交游戏就喜欢用这个框架改造。
使用框架的好处有:
1. 利用框架提供的标准程序架构和实用的组件进行高效开发
2. 利用框架完善的文档,有利于团队新成员培训和协作开发,减少沟通成本
能达到以上目的,都算不错的框架。因为目前主流框架都是MVC结构+一些实用的组件、类库,除了数据库处理这一块,其他地方差别不大。
个人推荐Zend Framework和Yii。 最好的php框架当然是spring,呵呵 。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

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,

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 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...

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

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

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

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�...
