位元詩人 技術雜談:比較 PHP 網頁框架

Facebook Twitter LinkedIn LINE Skype EverNote GMail Yahoo Email

筆者先前因一些計畫需要使用 PHP 網頁框架,故整理了以下表格。雖然最後沒有實際用到,筆者將這個表格分享出來,給有這方面需求的讀者。這些比較的條件基於一般常見的網頁框架所會用到的特性,未針對某個特定框架。

Criteria Laravel Symfony Nette CodeIgniter Yii 2
License MIT MIT BSD MIT BSD
Architecture Full Full Full Full Full
Popularity 1st 2nd 3rd 4th 5th
Performance Slow Slow Slow Fast Fair
Template Blade Twig Latte PHP PHP
Database MySQL
PostgreSQL
SQLite
SQL Server
MySQL
PostgreSQL
SQLite
SQL Server
Oracle
MySQL
PostgreSQL
SQLite
SQL Server
Oracle
MySQL
PostgreSQL
SQLite
SQL Server
Oracle
MySQL
PostgreSQL
SQLite
SQL Server
Oracle
ORM Yes Doctrine PDO No built-in Active Record
Authentication Yes Yes Yes Yes Yes
Security Yes Yes Yes Yes Yes
Testing PHPUnit PHPUnit Built-in Built-in PHPUnit
i18n Yes Yes Third-party Third-party Yes
Criteria Zend 2 CakePHP Silex Silm Phalcon
License BSD MIT MIT MIT BSD
Architecture Full Full Micro Micro Micro
Popularity 8th < 10th < 10th < 10th < 10th
Performance Slow Slow Fair Fast Fastest
Template PHP Built-in Twig Twig, PHP Volt
Database MySQL
PostgreSQL
SQLite
MySQL
PostgreSQL
SQLite
SQL Server
Oracle (plugin)
MySQL
PostgreSQL
SQLite
SQL Server
Oracle
MySQL
PostgreSQL
SQLite
SQL Server
MySQL
PostgreSQL
SQLite
ORM Doctrine Yes Doctrine No built-in Yes
Authentication Yes Yes Yes No built-in Yes
Security Yes Yes Yes No built-in Yes
Testing PHPUnit PHPUnit PHPUnit No built-in PHPUnit
i18n Yes Yes Yes No built-in No built-in

在這些框架中,Laravel 依然是最受歡迎的,整體資源也最多。雖然 Laravel 效能較慢,但網頁程式的效能瓶頸時常不在網頁本身,而在資料庫讀寫或後端運行的背景程式。通過表格比較,相對比較不受主觀意識影響或論壇的言論影響,而可客觀地選擇適合自已的網頁框架。

關於作者

位元詩人 (ByteBard) 是資訊領域碩士,喜歡用開源技術來解決各式各樣的問題。這類技術跨平台、重用性高、技術生命長。

除了開源技術以外,位元詩人喜歡日本料理和黑咖啡,會一些日文,有時會自助旅行。