Download - Secret sauce of building php applications
![Page 1: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/1.jpg)
Secret sauce of building PHP applications
林佑安 (Yo-An Lin)aka c9s
Monday, January 14, 13
![Page 2: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/2.jpg)
About
• GitHub, Twitter, Plurk: @c9s
• 220+ GitHub repository in Perl, VimL, PHP, JavaScript and Go.
Monday, January 14, 13
![Page 3: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/3.jpg)
為什麼是 PHP?
Monday, January 14, 13
![Page 4: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/4.jpg)
Hey! PHP Sucks
Monday, January 14, 13
![Page 5: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/5.jpg)
PHP Sucks!
Monday, January 14, 13
![Page 6: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/6.jpg)
2000 年開始使⽤用 PHP websites ⼤大幅成⻑⾧長
Monday, January 14, 13
![Page 7: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/7.jpg)
Monday, January 14, 13
![Page 8: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/8.jpg)
High traffic PHP websites
⾼高流量 PHP 網站
Monday, January 14, 13
![Page 9: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/9.jpg)
Monday, January 14, 13
![Page 10: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/10.jpg)
Monday, January 14, 13
![Page 11: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/11.jpg)
Monday, January 14, 13
![Page 12: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/12.jpg)
Monday, January 14, 13
![Page 13: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/13.jpg)
Monday, January 14, 13
![Page 14: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/14.jpg)
Monday, January 14, 13
![Page 15: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/15.jpg)
Monday, January 14, 13
![Page 16: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/16.jpg)
http://highscalability.com/flickr-architecture
Monday, January 14, 13
![Page 17: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/17.jpg)
Monday, January 14, 13
![Page 18: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/18.jpg)
Monday, January 14, 13
![Page 19: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/19.jpg)
Monday, January 14, 13
![Page 20: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/20.jpg)
Monday, January 14, 13
![Page 21: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/21.jpg)
Monday, January 14, 13
![Page 22: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/22.jpg)
Monday, January 14, 13
![Page 23: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/23.jpg)
Monday, January 14, 13
![Page 24: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/24.jpg)
Monday, January 14, 13
![Page 25: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/25.jpg)
Monday, January 14, 13
![Page 26: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/26.jpg)
Applications developed with Symfony.
http://trac.symfony-project.org/wiki/ApplicationsDevelopedWithSymfony
1000+ websites listed.
Monday, January 14, 13
![Page 27: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/27.jpg)
Yii powered applications
http://www.yiiframework.com/forum/index.php/forum/14-yii-powered-
applications/
Monday, January 14, 13
![Page 28: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/28.jpg)
⼤大家都跑 PHP
Monday, January 14, 13
![Page 29: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/29.jpg)
為什麼?
Monday, January 14, 13
![Page 30: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/30.jpg)
劣即是夯唐鳳 - OSDC 2012
Monday, January 14, 13
![Page 31: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/31.jpg)
有多夯?
Monday, January 14, 13
![Page 32: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/32.jpg)
去街上問
Monday, January 14, 13
![Page 33: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/33.jpg)
⼗十個有九個都會寫 PHP
Monday, January 14, 13
![Page 34: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/34.jpg)
你Grandma都會寫 PHP
我也寫 PHP
Monday, January 14, 13
![Page 35: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/35.jpg)
但是Monday, January 14, 13
![Page 36: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/36.jpg)
你還在使⽤用⽯石器時代的 PHP 嗎?
Monday, January 14, 13
![Page 37: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/37.jpg)
⽯石器時代 PHP ?
Monday, January 14, 13
![Page 38: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/38.jpg)
⽯石器時代義⼤大利麵
Monday, January 14, 13
![Page 39: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/39.jpg)
⽯石器時代 PHP
Monday, January 14, 13
![Page 40: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/40.jpg)
⽯石器時代 PHP
• Dreamweaver PHP 產⽣生器 (⻤⿁鬼才看得懂)
Monday, January 14, 13
![Page 41: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/41.jpg)
⽯石器時代 PHP
• Dreamweaver PHP 產⽣生器 (⻤⿁鬼才看得懂)
• Copy & Paste (品質低落)
Monday, January 14, 13
![Page 42: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/42.jpg)
⽯石器時代 PHP
• Dreamweaver PHP 產⽣生器 (⻤⿁鬼才看得懂)
• Copy & Paste (品質低落)
• .inc 附檔名 (安全漏洞)
Monday, January 14, 13
![Page 43: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/43.jpg)
⽯石器時代 PHP
• Dreamweaver PHP 產⽣生器 (⻤⿁鬼才看得懂)
• Copy & Paste (品質低落)
• .inc 附檔名 (安全漏洞)
• ⼤大量的 require 呼叫循環 (效能問題)
Monday, January 14, 13
![Page 44: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/44.jpg)
⽯石器時代 PHP
• Dreamweaver PHP 產⽣生器 (⻤⿁鬼才看得懂)
• Copy & Paste (品質低落)
• .inc 附檔名 (安全漏洞)
• ⼤大量的 require 呼叫循環 (效能問題)
• HTML Render 不做 Escape (XSS 漏洞)
Monday, January 14, 13
![Page 45: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/45.jpg)
⽯石器時代 PHP
• Dreamweaver PHP 產⽣生器 (⻤⿁鬼才看得懂)
• Copy & Paste (品質低落)
• .inc 附檔名 (安全漏洞)
• ⼤大量的 require 呼叫循環 (效能問題)
• HTML Render 不做 Escape (XSS 漏洞)
• POST/GET 從不過濾 (SQL Injection)
Monday, January 14, 13
![Page 46: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/46.jpg)
為什麼?
Monday, January 14, 13
![Page 47: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/47.jpg)
24⼩小時學會 PHP
Monday, January 14, 13
![Page 48: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/48.jpg)
• 語⾔言學習⼊入⾨門⾨門檻低
24⼩小時學會 PHP
Monday, January 14, 13
![Page 49: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/49.jpg)
• 語⾔言學習⼊入⾨門⾨門檻低• 隨便寫,丟給 Apache 就可以執⾏行了
24⼩小時學會 PHP
Monday, January 14, 13
![Page 50: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/50.jpg)
• 語⾔言學習⼊入⾨門⾨門檻低• 隨便寫,丟給 Apache 就可以執⾏行了
• $_POST, $_GET 是什麼⻤⿁鬼 (管他,可以跑就好了)
24⼩小時學會 PHP
Monday, January 14, 13
![Page 51: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/51.jpg)
• 語⾔言學習⼊入⾨門⾨門檻低• 隨便寫,丟給 Apache 就可以執⾏行了
• $_POST, $_GET 是什麼⻤⿁鬼 (管他,可以跑就好了)
• 義⼤大利麵好煮⼜又好吃,維護是什麼?沒聽過!
24⼩小時學會 PHP
Monday, January 14, 13
![Page 52: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/52.jpg)
寫這樣的 PHP您⼼心安嗎?
Monday, January 14, 13
![Page 53: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/53.jpg)
The Modern PHP Solution現代 PHP 解決⽅方案
Monday, January 14, 13
![Page 54: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/54.jpg)
Modern Tools
• PSR
• Composer / Onion / PEAR / Pyrus
• phpbrew / phpenv / phpbuild
• ClassLoader via spl_autoload_* functions
• New language features (traits, spl, generator...)
Monday, January 14, 13
![Page 55: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/55.jpg)
PHP spl_autoload_*
Monday, January 14, 13
![Page 56: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/56.jpg)
Zend Engine Compilation
Monday, January 14, 13
![Page 57: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/57.jpg)
Request
ScanningLexing
AST ParsingCompilation
Execution
File a.php
Output
Zend EngineCompilation
Monday, January 14, 13
![Page 58: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/58.jpg)
Request
ScanningLexingParsing
Compilation
Execution
File a.php
Output
Require b.php Require c.php Require d.php Require e.php
ScanningLexingParsing
Compilation
ScanningLexingParsing
Compilation
ScanningLexingParsing
Compilation
Monday, January 14, 13
![Page 59: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/59.jpg)
Request
ScanningLexingParsing
Compilation
Execution
File a.php
Output
Require b.php Require c.php Require d.php Require e.php
ScanningLexingParsing
Compilation
ScanningLexingParsing
Compilation
ScanningLexingParsing
Compilation
只⽤用到 b.php 的 function
Monday, January 14, 13
![Page 60: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/60.jpg)
Request
ScanningLexingParsing
Compilation
Execution
File a.php
Output
Require b.php Require c.php Require d.php Require e.php
ScanningLexingParsing
Compilation
ScanningLexingParsing
Compilation
ScanningLexingParsing
Compilation
資源浪費 (CPU + Memory) x 100,000
x 100,000
Monday, January 14, 13
![Page 61: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/61.jpg)
那 APC 呢?
Monday, January 14, 13
![Page 62: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/62.jpg)
Request
ScanningLexingParsing
Compilation
Execution
File a.php
Output
Require b.php Require c.php Require d.php Require e.php
fstat checkunserialize op cache
fstat checkunserialize op cache
fstat checkunserialize op cache
仍須作 filestat check (default)Memory 照樣浪費
x 100,000
Monday, January 14, 13
![Page 63: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/63.jpg)
Monday, January 14, 13
![Page 64: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/64.jpg)
這就是WordPress 慢的原因
http://talks.php.net/presentations/slides/intro/wp_inclued1.png
Monday, January 14, 13
![Page 65: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/65.jpg)
PHP spl_autoload_*
• PHP 5.3+ 的新功能。
Monday, January 14, 13
![Page 66: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/66.jpg)
PHP spl_autoload_*
• PHP 5.3+ 的新功能。
• 可註冊⾃自訂的類別載⼊入策略 (autoloading strategy)
Monday, January 14, 13
![Page 67: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/67.jpg)
PHP spl_autoload_*
• PHP 5.3+ 的新功能。
• 可註冊⾃自訂的類別載⼊入策略 (autoloading strategy)
• 對於找不到定義的類別,⾃自動呼叫 class loader 進⾏行類別的⾃自動載⼊入。
Monday, January 14, 13
![Page 68: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/68.jpg)
PHP spl_autoload_*
• PHP 5.3+ 的新功能。
• 可註冊⾃自訂的類別載⼊入策略 (autoloading strategy)
• 對於找不到定義的類別,⾃自動呼叫 class loader 進⾏行類別的⾃自動載⼊入。
• 每個 request 只會載⼊入⾃自⼰己需要的 class,⽤用越少,載越少。
Monday, January 14, 13
![Page 69: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/69.jpg)
PSR⾞車同軌,書同⽂文
Monday, January 14, 13
![Page 70: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/70.jpg)
PSR-0 for PHP class
定義了 ClassLoader 的規範
Monday, January 14, 13
![Page 71: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/71.jpg)
$bar = new Foo\Bar;spl_autoload_call(“Foo\Bar”)
Monday, January 14, 13
![Page 72: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/72.jpg)
Package dependency套件相依性
Monday, January 14, 13
![Page 73: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/73.jpg)
套件相依性可以很混亂
Monday, January 14, 13
![Page 74: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/74.jpg)
Package dependencies
Monday, January 14, 13
![Page 75: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/75.jpg)
Package dependencies
Monday, January 14, 13
![Page 76: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/76.jpg)
Package dependencies
Monday, January 14, 13
![Page 77: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/77.jpg)
Composer
http://www.slideshare.net/naderman/composer-9206307
https://github.com/composer/composer
Monday, January 14, 13
![Page 78: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/78.jpg)
Composer
• composer.json 取材於 Node.js NPM
http://www.slideshare.net/naderman/composer-9206307
https://github.com/composer/composer
Monday, January 14, 13
![Page 79: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/79.jpg)
Composer
• composer.json 取材於 Node.js NPM
• 更好的相依性解決⽅方案 SAT,取材於 OpenSuse 的 minisat / libzypper
http://www.slideshare.net/naderman/composer-9206307
https://github.com/composer/composer
Monday, January 14, 13
![Page 80: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/80.jpg)
Composer
• composer.json 取材於 Node.js NPM
• 更好的相依性解決⽅方案 SAT,取材於 OpenSuse 的 minisat / libzypper
• Satis package repository 可架設套件庫
http://www.slideshare.net/naderman/composer-9206307
https://github.com/composer/composer
Monday, January 14, 13
![Page 81: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/81.jpg)
Composer
• composer.json 取材於 Node.js NPM
• 更好的相依性解決⽅方案 SAT,取材於 OpenSuse 的 minisat / libzypper
• Satis package repository 可架設套件庫
• composer.lock 可鎖定套件相依資料
http://www.slideshare.net/naderman/composer-9206307
https://github.com/composer/composer
Monday, January 14, 13
![Page 82: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/82.jpg)
Composer
• composer.json 取材於 Node.js NPM
• 更好的相依性解決⽅方案 SAT,取材於 OpenSuse 的 minisat / libzypper
• Satis package repository 可架設套件庫
• composer.lock 可鎖定套件相依資料
• ⼯工具逐漸成熟,越來越多⼈人使⽤用http://www.slideshare.net/naderman/composer-9206307
https://github.com/composer/composer
Monday, January 14, 13
![Page 83: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/83.jpg)
Onionhttp://github.com/c9s/Onion
Monday, January 14, 13
![Page 84: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/84.jpg)
Onion
• PEAR 向後相容⼯工具
http://github.com/c9s/Onion
Monday, January 14, 13
![Page 85: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/85.jpg)
Onion
• PEAR 向後相容⼯工具
• 提供簡易的套件定義 package.ini
http://github.com/c9s/Onion
Monday, January 14, 13
![Page 86: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/86.jpg)
Onion
• PEAR 向後相容⼯工具
• 提供簡易的套件定義 package.ini
• 可快速打包成 PEAR 套件
http://github.com/c9s/Onion
Monday, January 14, 13
![Page 87: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/87.jpg)
Onion
• PEAR 向後相容⼯工具
• 提供簡易的套件定義 package.ini
• 可快速打包成 PEAR 套件
• 可 Bundle 安裝 PEAR 套件 (like Ruby Bundler)
http://github.com/c9s/Onion
Monday, January 14, 13
![Page 88: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/88.jpg)
PHP 版本環境⼯工具
Monday, January 14, 13
![Page 89: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/89.jpg)
phpbrewhttp://github.com/c9s/phpbrew
Monday, January 14, 13
![Page 90: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/90.jpg)
phpbrew
• 取材⾃自 @gugod perlbrew
http://github.com/c9s/phpbrew
Monday, January 14, 13
![Page 91: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/91.jpg)
phpbrew
• 取材⾃自 @gugod perlbrew
• 易於切換 PHP 相關版本
http://github.com/c9s/phpbrew
Monday, January 14, 13
![Page 92: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/92.jpg)
phpbrew
• 取材⾃自 @gugod perlbrew
• 易於切換 PHP 相關版本
• 提供 variant 建置選項 +mysql, +pgsql...etc
http://github.com/c9s/phpbrew
Monday, January 14, 13
![Page 93: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/93.jpg)
phpbrew
• 取材⾃自 @gugod perlbrew
• 易於切換 PHP 相關版本
• 提供 variant 建置選項 +mysql, +pgsql...etc
• 不需 root 權限
http://github.com/c9s/phpbrew
Monday, January 14, 13
![Page 94: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/94.jpg)
phpbrew
• 取材⾃自 @gugod perlbrew
• 易於切換 PHP 相關版本
• 提供 variant 建置選項 +mysql, +pgsql...etc
• 不需 root 權限
• 平台⽀支援: Mac OS X 10.5+, Ubuntu, Debian..
http://github.com/c9s/phpbrew
Monday, January 14, 13
![Page 95: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/95.jpg)
PHP library/app from corneltek
Monday, January 14, 13
![Page 96: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/96.jpg)
PHP Projects• phpbrew
• CLIFramework
• Onion
• Roller Router
• LazyRecord
• ActionKit
• PEARX
• Universal
• FormKit
• ValidationKit
• ClassMap
• GetOptionKit
族繁不及備載...
Monday, January 14, 13
![Page 97: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/97.jpg)
為什麼要重造輪⼦子?
Monday, January 14, 13
![Page 98: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/98.jpg)
設計軟體 != 設計輪⼦子
Monday, January 14, 13
![Page 99: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/99.jpg)
It’s not that simple並⾮非像輪⼦子那樣的簡單
Monday, January 14, 13
![Page 100: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/100.jpg)
軟體有相依性但輪⼦子沒有
Monday, January 14, 13
![Page 101: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/101.jpg)
⼀一旦應⽤用程式相依了他⼈人的框架你的開發模式也將受到侷限
Monday, January 14, 13
![Page 102: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/102.jpg)
開發⼯工具與⼈人息息相關但輪⼦子只需透過輪軸傳動
Monday, January 14, 13
![Page 103: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/103.jpg)
使⽤用他⼈人的 FullStack 框架
Monday, January 14, 13
![Page 104: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/104.jpg)
嘗到的是短期的甜頭
Monday, January 14, 13
![Page 105: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/105.jpg)
犧牲的是未來的無限可能
Monday, January 14, 13
![Page 106: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/106.jpg)
什麼是 FullStack Framework ?
Monday, January 14, 13
![Page 107: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/107.jpg)
就是⼀一整包送給你
Monday, January 14, 13
![Page 108: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/108.jpg)
FullStack Framework
• Rails
• Zend Framework
• Symfony
• WordPress
• Joomla
• etc...
Monday, January 14, 13
![Page 109: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/109.jpg)
FW 1.0
使⽤用⼀一個架構快速⼤大幅修改的框架
Monday, January 14, 13
![Page 110: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/110.jpg)
FW 1.0
App A
使⽤用⼀一個架構快速⼤大幅修改的框架
這個 FW 好像不錯來⽤用⽤用看
Monday, January 14, 13
![Page 111: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/111.jpg)
FW 1.0 FW 2.0
App A
使⽤用⼀一個架構快速⼤大幅修改的框架
Monday, January 14, 13
![Page 112: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/112.jpg)
FW 1.0 FW 2.0
App A App B
使⽤用⼀一個架構快速⼤大幅修改的框架
2.0 有個功能 X 實在太棒了,趕快來⽤用
改太多沒時間升級啦不管了
Monday, January 14, 13
![Page 113: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/113.jpg)
FW 1.0 FW 2.0 FW 3.0
App A App B
使⽤用⼀一個架構快速⼤大幅修改的框架
Monday, January 14, 13
![Page 114: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/114.jpg)
FW 1.0 FW 2.0 FW 3.0
App A App B
使⽤用⼀一個架構快速⼤大幅修改的框架
相依於 FW2.0 的 X 功能但 FW3.0 卻拿掉了 X
Migration is hard!
Monday, January 14, 13
![Page 115: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/115.jpg)
FW 1.0 FW 2.0 FW 3.0
App A App B
使⽤用⼀一個架構快速⼤大幅修改的框架
App C
無形之中增加的維護成本怕跟不上潮流,於是新網站⼜又使⽤用 FW 3.0
Monday, January 14, 13
![Page 116: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/116.jpg)
FW 1.0 FW 2.0 FW 3.0 bug fix security fix
App A App B
使⽤用⼀一個架構快速⼤大幅修改的框架
App C
新的修正只適⽤用新的版本但由於架構⼤大幅修改,同樣的 patch 無法直接套⽤用於 FW 2.0 的 App B,只能⼿手動修改
bug fix security fix
Monday, January 14, 13
![Page 117: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/117.jpg)
使⽤用 FullStack 框架之侷限
Monday, January 14, 13
![Page 118: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/118.jpg)
使⽤用 FullStack 框架之侷限• 隨著框架不斷修改內建⾏行為, 升級的過程,就會有越多不確定因素(bug, security)
Monday, January 14, 13
![Page 119: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/119.jpg)
使⽤用 FullStack 框架之侷限• 隨著框架不斷修改內建⾏行為, 升級的過程,就會有越多不確定因素(bug, security)
• 網站規模越⼤大,升級越苦。
Monday, January 14, 13
![Page 120: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/120.jpg)
使⽤用 FullStack 框架之侷限• 隨著框架不斷修改內建⾏行為, 升級的過程,就會有越多不確定因素(bug, security)
• 網站規模越⼤大,升級越苦。• 功能開發及系統效能會因為框架⽽而有所限制。
Monday, January 14, 13
![Page 121: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/121.jpg)
Allen Own 不安定因素
Monday, January 14, 13
![Page 122: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/122.jpg)
Allen Own 不安定因素
Monday, January 14, 13
![Page 123: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/123.jpg)
So how do we do that?
Monday, January 14, 13
![Page 124: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/124.jpg)
Divide and Conquer
Monday, January 14, 13
![Page 125: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/125.jpg)
Framework should just be “framework”
Monday, January 14, 13
![Page 126: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/126.jpg)
Components should be easy to adapt/swap
Monday, January 14, 13
![Page 127: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/127.jpg)
Each component should have a package state
- API stability-Package stability
Monday, January 14, 13
![Page 128: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/128.jpg)
Framework
Component A
Component B
Component C
The core is pretty small, we don’t need to change
core API frequently
Monday, January 14, 13
![Page 129: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/129.jpg)
Framework
Component A 2.0
Component B
Component C
API LockStable
API LockBeta Stability
API BetaBeta Stability
API LockStable
Monday, January 14, 13
![Page 130: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/130.jpg)
Framework
Component A 2.0
Component B
Component C
API LockStable
API LockBeta Stability
API BetaBeta Stability
Framework BNew Concept
API LockStable
We can build another new framework very easily.
Monday, January 14, 13
![Page 131: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/131.jpg)
How do we build CLI applications?
Monday, January 14, 13
![Page 132: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/132.jpg)
CLIFrameworkhttps://github.com/c9s/CLIFramework
Monday, January 14, 13
![Page 133: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/133.jpg)
CLIFramework
• 提供最快最簡易的⽅方式建置⼀一個命令列的⼯工具
• phpbrew, onion, classmap ... etc
Monday, January 14, 13
![Page 134: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/134.jpg)
CLIFramework
⽀支持⼦子命令及⼦子命令選項
Monday, January 14, 13
![Page 135: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/135.jpg)
CLIFramework<?phpnamespace TestApp\Command;use CLIFramework\Command;class ListCommand extends Command { function execute($arg1,$arg2) { // .. do something here... }}
Monday, January 14, 13
![Page 136: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/136.jpg)
CLIFramework<?phpnamespace YourApp;use CLIFramework\Application;
class CLIApplication extends Application{
/* init your application options here */ function options($opts) { $opts->add('v|verbose', 'verbose message'); $opts->add('path:', 'required option with a value.'); $opts->add('path?', 'optional option with a value'); $opts->add('path+', 'multiple value option.'); }
/* register your command here */ function init() { $this->registerCommand( 'list', '\YourApp\Command\ListCommand' ); $this->registerCommand( 'foo', '\YourApp\Command\FooCommand' ); }}
Monday, January 14, 13
![Page 137: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/137.jpg)
CLIFramework
<?php
$app = new \TestApp\Application;$app->run($argv);
Monday, January 14, 13
![Page 138: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/138.jpg)
CLIFramework
⾃自動產⽣生的 Command-line help
Monday, January 14, 13
![Page 139: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/139.jpg)
How do we generate forms?
Monday, January 14, 13
![Page 140: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/140.jpg)
FormKithttps://github.com/c9s/FormKit
Monday, January 14, 13
![Page 141: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/141.jpg)
FormKit
• A powerful form widget generator.
• Simple API for defining widgets and layout.
• Customizable layout engine.
Monday, January 14, 13
![Page 142: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/142.jpg)
FormKit: TextInput
<?php$text = new FormKit\Widget\TextInput('username', array( 'label' => 'Username', 'placeholder' => 'Your name please', 'hint' => 'Please enter 6 characters for your username',));$text->value( 'default' ) ->size(20);echo $text; // render
Monday, January 14, 13
![Page 143: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/143.jpg)
FormKit<?php$countries = new FormKit\Widget\SelectInput( 'country' , array( 'label' => 'Country', 'options' => array( 'Test' => 'Test', 'Asia' => array( 'Taiwan', 'Taipei', 'Tainan', 'Tokyo', 'Korea', ) )));
Monday, January 14, 13
![Page 144: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/144.jpg)
FormKit: GenericLayout<?php$layout = new FormKit\Layout\GenericLayout;$layout->width(400);$layout->addWidget( $text ) ->addWidget( $password ) ->addWidget( $remember ) ->addWidget( $birthday ) ->addWidget( $best_time ) ->addWidget( $role ) ->addWidget( $size ) ->addWidget( $countries ) ->cellpadding(6) ->cellspacing(6) ->border(0);echo $layout;
Monday, January 14, 13
![Page 145: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/145.jpg)
FormKit: Helpers
<?phpuse FormKit\FormKit;$username = FormKit::text('username');$password = FormKit::password('password',array( 'class' => 'your-element-class-name', 'id' => 'your-element-id', 'value' => 'default password',));echo $username->render();echo $password->render();
Monday, January 14, 13
![Page 146: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/146.jpg)
Available Widgets• TextareaInput
• TextInput
• ButtonInput
• CheckboxInput
• ColorInput
• DateInput
• DatetimeInput
• FileInput
• HiddenInput
• Label
• PasswordInput
• RadioInput
• ResetInput
• SelectInput
• SubmitInput
• AjaxCompleteInput
• CanvasInput
Monday, January 14, 13
![Page 147: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/147.jpg)
For more detailshttp://github.com/c9s/FormKit
Monday, January 14, 13
![Page 148: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/148.jpg)
How do we define logics for forms?
Monday, January 14, 13
![Page 149: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/149.jpg)
ActionKithttps://github.com/c9s/ActionKit
Monday, January 14, 13
![Page 150: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/150.jpg)
ActionKit
• Let you define logics and form field definitions.
• Use FormKit to render form fields automatically.
Monday, January 14, 13
![Page 151: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/151.jpg)
If I have a login form and login logics
Monday, January 14, 13
![Page 152: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/152.jpg)
<?phpnamespace User\Action;use ActionKit;
class Login extends \ActionKit\Action{ public function scheme() { $this->param("account") ->renderAs("TextInput");
$this->param("password") ->renderAs("PasswordInput");
$this->param("remember_me"); }}
Define your form fields.
Monday, January 14, 13
![Page 153: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/153.jpg)
<?phpnamespace User\Action;use ActionKit;
class Login extends \ActionKit\Action{ public function scheme() { $this->param("account") ->renderAs("TextInput");
$this->param("password") ->renderAs("PasswordInput");
$this->param("remember_me"); }
public function run() { $account = $this->arg('account'); $password = $this->arg('password');
/* your login logics here */
return $this->success('Login successfully'); }}
Define your logics here.
Monday, January 14, 13
![Page 154: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/154.jpg)
ActionKit: The API
<?php$action = new User\Action\Login;echo $action->createView()->render();
// customized action layout.echo $action->createView("CustomziedLayoutClass")->render();
Render the form.
Monday, January 14, 13
![Page 155: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/155.jpg)
ActionKit: The API
<?php$runner = ActionKit\ActionRunner::getInstance();$runner->registerAutoloader();
$result = $runner->run("User\\Action\\Login");if( $result && $runner->isAjax() ) { // JSON header('Content-Type: application/json; Charset=utf-8'); echo $result->__toString(); exit(0);}
Handle the logics and return the result.
Monday, January 14, 13
![Page 156: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/156.jpg)
How do we dispatch URL?
Monday, January 14, 13
![Page 157: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/157.jpg)
Roller Routerhttps://github.com/c9s/Roller
Monday, January 14, 13
![Page 158: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/158.jpg)
Roller Router• A fast router for PHP.
Monday, January 14, 13
![Page 159: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/159.jpg)
Roller Router• A fast router for PHP.
• Designed for performance.
Monday, January 14, 13
![Page 160: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/160.jpg)
Roller Router• A fast router for PHP.
• Designed for performance.
• Let you define plugins, routes easily.
Monday, January 14, 13
![Page 161: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/161.jpg)
Roller Router• A fast router for PHP.
• Designed for performance.
• Let you define plugins, routes easily.
• APC / File Cache.
Monday, January 14, 13
![Page 162: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/162.jpg)
Roller Router• A fast router for PHP.
• Designed for performance.
• Let you define plugins, routes easily.
• APC / File Cache.
• Annotation Reader support.
Monday, January 14, 13
![Page 163: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/163.jpg)
Roller Router• A fast router for PHP.
• Designed for performance.
• Let you define plugins, routes easily.
• APC / File Cache.
• Annotation Reader support.
• RESTful plugin
Monday, January 14, 13
![Page 164: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/164.jpg)
Roller Router• A fast router for PHP.
• Designed for performance.
• Let you define plugins, routes easily.
• APC / File Cache.
• Annotation Reader support.
• RESTful plugin
• With C Extension support.
Monday, January 14, 13
![Page 165: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/165.jpg)
Roller Router<?php$router = new Roller\Router( null, array( 'cache_id' => 'router_demo'));
Monday, January 14, 13
![Page 166: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/166.jpg)
Roller Router<?php$router = new Roller\Router( null, array( 'cache_id' => 'router_demo'));$router->add( '/:id/:name' , function($id,$name) { return sprintf('Hello %s, %d', $name, $id);});
Monday, January 14, 13
![Page 167: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/167.jpg)
Roller Router<?php$router = new Roller\Router( null, array( 'cache_id' => 'router_demo'));$router->add( '/:id/:name' , function($id,$name) { return sprintf('Hello %s, %d', $name, $id);});
$r = $router->dispatch( $_SERVER['PATH_INFO'] );if( $r !== false ) echo $r();else die('page not found.');
Monday, January 14, 13
![Page 168: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/168.jpg)
Roller: Add routes
<?php$router->add( '/posts/:id', array('PostController','readPostAction') );
Monday, January 14, 13
![Page 169: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/169.jpg)
Roller with DSL
<?phprequire 'bootstrap.php';require 'Roller/DSL.php';
on('/path',function() { return 'your content';});
on('/path/to/:year', [ ':year' => '\d+' ] ,function() { return 'your content';});
dispatch( $_SERVER['PATH_INFO'] );
Monday, January 14, 13
![Page 170: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/170.jpg)
One more thing!
Monday, January 14, 13
![Page 171: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/171.jpg)
If you’re using PHP5.4+
Monday, January 14, 13
![Page 172: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/172.jpg)
You can even use the built-in HTTP server.
Monday, January 14, 13
![Page 173: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/173.jpg)
Roller Router
<?phpif (php_sapi_name() == 'cli-server') { $uri = $_SERVER['REQUEST_URI']; $info = parse_url($uri); if (preg_match('/\.(?:png|jpg|jpeg|gif|js|css)$/', $info['path'] )) return false; // serve the requested resource as-is. $path = ltrim($info['path'],'/'); if( file_exists($path) ) return false; $pathinfo = $info['path'];} else { $pathinfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/';}
... $router here
Monday, January 14, 13
![Page 174: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/174.jpg)
$ php -S localhost:8888 router.php
Monday, January 14, 13
![Page 175: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/175.jpg)
How about RESTful?
Monday, January 14, 13
![Page 176: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/176.jpg)
Roller + RESTful<?php
class MyGenericHandler extends Roller\Plugin\RESTful\GenericHandler{
public function create($resource) { return array( 'id' => 99 ); }
public function load($resource,$id) { return array( 'id' => $id ); }
public function update($resource,$id) { $put = $this->parseInput(); return $put; }
public function delete($resource,$id) { $args = $this->parseInput(); // print_r($args); return array( 'id' => $id ); }
public function find($resource) { return range(1,10); }}
Monday, January 14, 13
![Page 177: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/177.jpg)
Mount your RESTful handler
$restful = new Roller\Plugin\RESTful(array( 'prefix' => '/=' ));$restful->setGenericHandler( 'MyGenericHandler' );
$router->addPlugin($restful);
GET http://localhost:8888/=/book/1POST http://localhost:8888/=/book
Monday, January 14, 13
![Page 178: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/178.jpg)
For more detailshttp://github.com/c9s/Roller
Monday, January 14, 13
![Page 179: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/179.jpg)
LazyRecordhttps://github.com/c9s/Roller
Monday, January 14, 13
![Page 180: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/180.jpg)
A Fast PHP ORM
Monday, January 14, 13
![Page 181: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/181.jpg)
Why another PHP ORM ?
Monday, January 14, 13
![Page 182: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/182.jpg)
PHP ORMs
• Doctrine
Monday, January 14, 13
![Page 183: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/183.jpg)
PHP ORMs
• Doctrine
• Propel
Monday, January 14, 13
![Page 184: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/184.jpg)
PHP ORMs
• Doctrine
• Propel
• Idiorm / Paris
Monday, January 14, 13
![Page 185: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/185.jpg)
Propel / Doctrine
• Propel uses XML Schema file.
Monday, January 14, 13
![Page 186: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/186.jpg)
Propel / Doctrine
• Propel uses XML Schema file.
• Doctrine uses XML/YAML/Annotations.
Monday, January 14, 13
![Page 187: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/187.jpg)
Propel / Doctrine
• Propel uses XML Schema file.
• Doctrine uses XML/YAML/Annotations.
• Slow & Fat.
Monday, January 14, 13
![Page 188: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/188.jpg)
Propel / Doctrine
• Propel uses XML Schema file.
• Doctrine uses XML/YAML/Annotations.
• Slow & Fat.
• Doctrine is too complicated.
Monday, January 14, 13
![Page 189: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/189.jpg)
Common characteristic
Monday, January 14, 13
![Page 190: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/190.jpg)
• XML for configuration file.
• XML for schema file.
• XML for everything.
• Concepts are from Java, too complicated.
Monday, January 14, 13
![Page 191: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/191.jpg)
Propel XML runtime.conf
Monday, January 14, 13
![Page 192: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/192.jpg)
<?xml version="1.0"?><config> <log> <ident>propel-bookstore</ident> <type>console</type> <level>7</level> </log> <propel> <datasources default="bookstore"> <datasource id="bookstore"> <adapter>sqlite</adapter> <connection> <classname>DebugPDO</classname> <dsn>mysql:host=localhost;dbname=bookstore</dsn> <user>testuser</user> <password>password</password> <options> <option id="ATTR_PERSISTENT">false</option> </options> <attributes> <option id="ATTR_EMULATE_PREPARES">true</option> </attributes> <settings> <setting id="charset">utf8</setting> <setting id="queries"> <query>set search_path myschema, public</query><!-- automatically set postgresql's search_path --> <query>INSERT INTO BAR ('hey', 'there')</query><!-- execute some other query --> </setting> </settings> </connection> <slaves> <connection> <dsn>mysql:host=slave-server1; dbname=bookstore</dsn> </connection> <connection> <dsn>mysql:host=slave-server2; dbname=bookstore</dsn> </connection> </slaves> </datasource> </datasources> <debugpdo> <logging> <details> <method> <enabled>true</enabled> </method> <time> <enabled>true</enabled> <precision>3</precision> </time> <mem> <enabled>true</enabled> <precision>1</precision> </mem> </details> </logging> </debugpdo> </propel></config>
Monday, January 14, 13
![Page 193: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/193.jpg)
<?xml version="1.0"?><config> <log> <ident>propel-bookstore</ident> <type>console</type> <level>7</level> </log> <propel> <datasources default="bookstore"> <datasource id="bookstore"> <adapter>sqlite</adapter> <connection> <classname>DebugPDO</classname> <dsn>mysql:host=localhost;dbname=bookstore</dsn> <user>testuser</user> <password>password</password> <options> <option id="ATTR_PERSISTENT">false</option> </options> <attributes> <option id="ATTR_EMULATE_PREPARES">true</option> </attributes> <settings> <setting id="charset">utf8</setting> <setting id="queries"> <query>set search_path myschema, public</query><!-- automatically set postgresql's search_path --> <query>INSERT INTO BAR ('hey', 'there')</query><!-- execute some other query --> </setting> </settings> </connection> <slaves> <connection> <dsn>mysql:host=slave-server1; dbname=bookstore</dsn> </connection> <connection> <dsn>mysql:host=slave-server2; dbname=bookstore</dsn> </connection> </slaves> </datasource> </datasources> <debugpdo> <logging> <details> <method> <enabled>true</enabled> </method> <time> <enabled>true</enabled> <precision>3</precision> </time> <mem> <enabled>true</enabled> <precision>1</precision> </mem> </details> </logging> </debugpdo> </propel></config>
Monday, January 14, 13
![Page 194: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/194.jpg)
Monday, January 14, 13
![Page 195: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/195.jpg)
So we designed an easier ORM
Monday, January 14, 13
![Page 196: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/196.jpg)
LazyRecord
• Lazy attributes.
Monday, January 14, 13
![Page 197: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/197.jpg)
LazyRecord
• Lazy attributes.
• Lazy schema loader.
Monday, January 14, 13
![Page 198: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/198.jpg)
LazyRecord
• Lazy attributes.
• Lazy schema loader.
• Dynamic schema via PHP code
Monday, January 14, 13
![Page 199: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/199.jpg)
LazyRecord
• Lazy attributes.
• Lazy schema loader.
• Dynamic schema via PHP code
• Static schema class generator
Monday, January 14, 13
![Page 200: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/200.jpg)
LazyRecord
• Lazy attributes.
• Lazy schema loader.
• Dynamic schema via PHP code
• Static schema class generator
• SQL Generator for SQLite, MySQL & PgSQL.
Monday, January 14, 13
![Page 201: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/201.jpg)
LazyRecord
• Filter / Canonicalizer support.
Monday, January 14, 13
![Page 202: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/202.jpg)
LazyRecord
• Filter / Canonicalizer support.
• CRUD support via ActionKit.
Monday, January 14, 13
![Page 203: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/203.jpg)
LazyRecord
• Filter / Canonicalizer support.
• CRUD support via ActionKit.
• Form generation via ActionKit.
Monday, January 14, 13
![Page 204: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/204.jpg)
LazyRecord
• Filter / Canonicalizer support.
• CRUD support via ActionKit.
• Form generation via ActionKit.
• Migration support.
Monday, January 14, 13
![Page 205: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/205.jpg)
LazyRecord: Schema<?phpnamespace Todos\Model;use LazyRecord\BaseModel;
class Todo extends BaseModel { function schema($schema) { $schema->column('title') ->varchar(128) ->required() ; $schema->column('description') ->text();
$schema->column('created_on') ->timestamp() ->default(function() { return date('c'); });
$schema->seeds('Todos\Seed'); }}
Monday, January 14, 13
![Page 206: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/206.jpg)
LazyRecord: Model
<?php$author = new Author;$ret = $author->create([ 'name' => "Deflator Test $i", 'country' => 'Tokyo', 'confirmed' => true, 'date' => new DateTime('2011-01-01 00:00:00'),]);if( $ret->success ) { echo "Created!";} ActiveRecord Pattern
Monday, January 14, 13
![Page 207: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/207.jpg)
LazyRecord: Collection
<?php$authors = new AuthorCollection;foreach( $authors as $author ) { echo $author->name , "\n"}
Collection Iterating
Monday, January 14, 13
![Page 208: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/208.jpg)
LazyRecord: Collection
$authors = new AuthorCollection;$authors->where() ->equal('name','Foo') ->groupBy('name','address');
SQL Conditions via SQLBuilder
Monday, January 14, 13
![Page 209: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/209.jpg)
LazyRecord: Collection
$newAuthors = $authors->filter(function($item) { // do something else})->filter(function($item) { return $item->confirmed;});
Monday, January 14, 13
![Page 210: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/210.jpg)
Powerful features
Monday, January 14, 13
![Page 211: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/211.jpg)
Model Schema -> CRUD Actions ->
Form Layout
Monday, January 14, 13
![Page 212: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/212.jpg)
LazyRecord
Model Schema
Monday, January 14, 13
![Page 213: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/213.jpg)
LazyRecord
Model Schema ⇛ Action
Monday, January 14, 13
![Page 214: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/214.jpg)
LazyRecord
Model Schema ⇛ Action ⇛
CRUD
Monday, January 14, 13
![Page 215: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/215.jpg)
LazyRecord
App::Model::Phone ☚ write once
Monday, January 14, 13
![Page 216: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/216.jpg)
LazyRecord
App::Model::PhoneApp::Model::PhoneCollection
Monday, January 14, 13
![Page 217: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/217.jpg)
LazyRecord
App::Model::PhoneApp::Model::PhoneCollection
App::Action::CreatePhone
Monday, January 14, 13
![Page 218: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/218.jpg)
LazyRecord
App::Model::PhoneApp::Model::PhoneCollection
App::Action::CreatePhoneApp::Action::UpdatePhone
Monday, January 14, 13
![Page 219: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/219.jpg)
LazyRecord
App::Model::PhoneApp::Model::PhoneCollection
App::Action::CreatePhoneApp::Action::UpdatePhoneApp::Action::DeletePhone
Monday, January 14, 13
![Page 220: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/220.jpg)
LazyRecord
App::Model::PhoneApp::Model::PhoneCollection
App::Action::CreatePhoneApp::Action::UpdatePhoneApp::Action::DeletePhone
... or any other actions predefined.
Monday, January 14, 13
![Page 221: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/221.jpg)
LazyRecord
App::Model::PhoneApp::Model::PhoneCollection
App::Action::CreatePhoneApp::Action::UpdatePhoneApp::Action::DeletePhone
$phone->asCreateAction()->render();
... or any other actions predefined.
Monday, January 14, 13
![Page 222: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/222.jpg)
Migration
Monday, January 14, 13
![Page 223: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/223.jpg)
2013 年還在⾃自⼰己⼿手動下 SQL 做 migration 嗎?
Monday, January 14, 13
![Page 224: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/224.jpg)
Monday, January 14, 13
![Page 225: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/225.jpg)
Schema Upgrade
Monday, January 14, 13
![Page 226: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/226.jpg)
Monday, January 14, 13
![Page 227: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/227.jpg)
For more detailshttp://github.com/c9s/LazyRecord
http://www.slideshare.net/c9s/lazyrecord-the-fast-orm-for-php
Monday, January 14, 13
![Page 228: Secret sauce of building php applications](https://reader037.vdocuments.pub/reader037/viewer/2022103016/5552c3beb4c90581158b4975/html5/thumbnails/228.jpg)
Thank youFind me: Twitter: @c9s
Monday, January 14, 13