[PHP] 框架概念與設計模式 – PHP各框架功能對照

Intro

PHP有眾多框架可供選擇,本篇大致會以Laravel 5Yii 2CodeIgniter 3做舉例與對照。


Router

Features CodeIgniter 3 Yii 2 Laravel 5
Router
Controller預設路由 -
Action arguments轉譯成URI - -

Database/Model

Features CodeIgniter 3 Yii 2 Laravel 5
PDO 支援 支援 支援
Query Builder
ORM/Active Record - Active Record Eloquent
Read & Write Splitting -
Relations -
Validation -
Timestamps Behavior -
Eager Loading -
Junction Table -
Soft Deleting - -
Query Scopes - -

CodeIgniter 3 ORM yidas/codeigniter-model


View/Template

Features CodeIgniter 3 Yii 2 Laravel 5
View
Template Layout - 有(Pure PHP) Blade pattern
Template Engine - 不需要 Blade

Asset Manager

Features CodeIgniter 3 Yii 2 Laravel 5
Asset - -
Asset Bundle - -
Asset internal copy - 支援 -

DI (Dependency Injection)

Features CodeIgniter 3 Yii 2 Laravel 5
DI pattern -
Container - Container Service Container
Provider - Service Locator Service Provider
Container Singleton - 支援 支援
Central Provider - Application Component註冊 Provider Config註冊

Leave a Reply

Your email address will not be published. Required fields are marked *