美思 技術雜談:比較 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 效能較慢,但網頁程式的效能瓶頸時常不在網頁本身,而在資料庫讀寫或後端運行的背景程式。通過表格比較,相對比較不受主觀意識影響或論壇的言論影響,而可客觀地選擇適合自已的網頁框架。

關於作者

身為資訊領域碩士,美思認為開發應用程式的目的是為社會帶來價值。如果在這個過程中該軟體能成為永續經營的項目,那就是開發者和使用者雙贏的局面。

美思喜歡用開源技術來解決各式各樣的問題,但必要時對專有技術也不排斥。閒暇之餘,美思將所學寫成文章,放在這個網站上和大家分享。