Why to choose laravel framework

34
為為為為為 Laravel Framework 2016.03.03 Bo-Yi Wu

Transcript of Why to choose laravel framework

Page 1: Why to choose laravel framework

為什麼選擇 Laravel Framework

2016.03.03Bo-Yi Wu

Page 2: Why to choose laravel framework

關於我• Blog: https://blog.wu-boy.com/• Github: https://github.com/appleboy

Page 3: Why to choose laravel framework

PHP 這麼多套 Framework為什麼要選 Laravel

Page 5: Why to choose laravel framework

選框架就要看作者是誰

Page 6: Why to choose laravel framework

Laravel Framework

• 目前由 Taylor Otwell 負責開發及維護– 5.1 開始支援 LTS Release

• bug fixes are provided for 2 years

• security fixes are provided for 3 years

Page 7: Why to choose laravel framework

Open Source 最怕的就是後續無人維護

Page 8: Why to choose laravel framework

對於 Laravel Framework開發者不用擔心後續維護問題

Page 9: Why to choose laravel framework
Page 10: Why to choose laravel framework

PHP 有無套件管理系統

Page 11: Why to choose laravel framework

所有第三方套件都用 composer 來管理https://getcomposer.org

Page 13: Why to choose laravel framework

團隊 Coding Style 制定

Page 15: Why to choose laravel framework

專案遵守 PHP-FIG 規範http://www.php-fig.org

Page 16: Why to choose laravel framework

PHP-FIG

• 建議開發前請先閱讀底下規範– Basic Coding Standard (PSR-1)– Coding Style Guide (PSR-2)– Autoloading Standard (PSR-4)

Page 17: Why to choose laravel framework

良好的 Coding Style可以讓同事減少 Review 時間

Page 18: Why to choose laravel framework

開發環境流程每次開發新專案前,都要浪費很多時間在建置環境

MySQL, Nginx, Redis, PHP, Node … 前端 , 後端都有

Page 19: Why to choose laravel framework

還有 OS 環境要解決Linux, Windows, MacOSX還沒處理完一天時間就過了

Page 20: Why to choose laravel framework

Laravel Homestead不用在個人電腦架設任何環境

Page 21: Why to choose laravel framework

Laravel Homestead• Ubuntu 14.04• Git• PHP 7.0• HHVM• Nginx• MySQL• Sqlite3

• Postgres• Composer• Node (With PM2, Bower,

Grunt, and Gulp)• Redis• Memcached• Beanstalkd

https://laravel.com/docs/5.2/homestead

Page 22: Why to choose laravel framework

Laravel Routing

• 所有 Routing Path 寫到同一檔案 ( 方便偵錯 )– CSRF Protection– Route Groups– Route Model Binding

Page 23: Why to choose laravel framework
Page 24: Why to choose laravel framework

Laravel ServiceLaravel 提供完整的第三方服務

Page 25: Why to choose laravel framework

Laravel Service• Authentication ( 帳號登入 )• Authorization ( 權限管理 )• Artisan Console ( 專案 command line tool)• Cache (Memcached and Redis)• Localization ( 多國語言 )• Mail (SMTP, Mailgun, Mandrill, Amazon SES)• Pagination ( 分頁管理 )

Page 26: Why to choose laravel framework

Laravel Service• Queues (database, Beanstalkd,

Amazon SQS, Redis, and synchronous (for local use) driver)

• Task Scheduling ( 排程管理 )• Testing ( 後端邏輯測試 )• Validation ( 資料驗證 )

Page 27: Why to choose laravel framework

Laravel Elixir前端與後端互相合作的好工具

Page 28: Why to choose laravel framework

Laravel Elixir

• Less, Sass, PostCSS, Plain CSS• Coffee Script, Browserify, Babel, Scripts• Versioning / Cache Busting• BrowserSync

Page 29: Why to choose laravel framework

Database Migration$ php artisan make:migration create_users_table

$ php artisan migrate$ php artisan migrate:rollback

Page 30: Why to choose laravel framework

Database Migration

• 不用寫任何 SQL 語法• 用日期記錄 SQL 操作• 不用管 DataBase 為 MySQL,

Postgres, MSSQL …

Page 31: Why to choose laravel framework
Page 32: Why to choose laravel framework

Laravel ORMsimple ActiveRecord implementation

for working with your database

Page 33: Why to choose laravel framework

Eloquent ORM

• 好用的 ORM 減少開發者寫 SQL 時間– One to One– One to Many–Many to Many

Page 34: Why to choose laravel framework

學習資源• 線上影音教學網站 : https://laracasts.com• 台灣線上文件 : https://laravel.tw/• 台灣 FB 討論區 : https://goo.gl/UwRLGu• 社群整理文件 : http://bit.ly/laraveltw-

resource