FuelPHP をさわってみて #phpkansai

4584c227ef4ea69e789e5f53e0476418?s=47 omoon
May 17, 2012

FuelPHP をさわってみて #phpkansai

PHPカンファレンス関西2012 のセッションで使ったスライドです。

4584c227ef4ea69e789e5f53e0476418?s=128

omoon

May 17, 2012
Tweet

Transcript

  1. 'VFM1)1Λ͞ΘͬͯΈͯ େଜ૑ଠ࿠ 1)1ΧϯϑΝϨϯεؔ੢ 

  2. ࣗݾ঺հ

  3. None
  4. wେଜ૑ଠ࿠

  5. wେଜ૑ଠ࿠ wେࡕ෎஑ాࢢग़਎ɾࡏॅ

  6. wେଜ૑ଠ࿠ wେࡕ෎஑ాࢢग़਎ɾࡏॅ wגࣜձࣾλοϓ

  7. wେଜ૑ଠ࿠ wେࡕ෎஑ాࢢग़਎ɾࡏॅ wגࣜձࣾλοϓ w1)1͸೥͙Β͍

  8. wPNPPO

  9. wPNPPO

  10. wࠓ೔ͷελοϑͰ͢

  11. None
  12. ͨͩͷར༻ऀͰ͢

  13. ͜͜਺ϲ݄߹ؒΛΈͯ ͪΐͪ͜ΐ͜

  14. ݸਓతʹ̍ͭ

  15. None
  16. ۀ຿Ͱ̎ͭ

  17. None
  18. ͱͯ΋ָ͍͠

  19. ࠓ೔͸ͦ͏͍͏͸ͳ͠Λ͠·͢

  20. ๻ͷϑϨʔϜϫʔΫวྺ

  21. 4ZNGPOZ͇

  22. NZPQFOBSDIJWFPSH

  23. None
  24. ओʹσβΠϯ୲౰

  25. DBLF1)1Y

  26. ࣾ಺ͷ͓༡ͼΞϓϦ

  27. ࠳ંͨͨ͠Ίը૾ͳ͠

  28. ۀ຿Ͱ͸

  29. ࣾ಺ಠࣗϑϨʔϜϫʔΫ

  30. ΦϨΦϨϑϨʔϜϫʔΫ

  31. ΅͕͔͘Μ͕͑ͨ ͍͖͞ΐ͏ͷ;ΕʔΉΘʔ͘

  32. ࡞ͬͨ࣌͸࠷ߴͩͱࢥ͏

  33. ࡞͍ͬͯΔ͏ͪʹ࠷௿ͩͱࢥ͏

  34. ̎ճ࡞Γ௚͠

  35. ࠷৽൛Λ࡞Δ࣌ʹ 4ZNGPOZΛࢀߟʹͨ͠

  36. ׬શʹ৐Γ׵͑Δͷ͸ ೉͔ͬͨ͠

  37. ઌ݄4ZNGPOZษڧձΛ։࠵

  38. ͪͳΈʹ

  39. ࠓ೔ͷࢀՃऀΞϯέʔτ͸ ͦͷ੒ՌͰ͢

  40. ͝ڠྗΑΖ͓͘͠ئ͍͠·͢

  41. ͦͷ४උΛ͍݄ͯͨ̎͠ࠒ

  42. 'VFM1)1ʹग़ձͬͯ͠·ͬͨ

  43. ࠓ೔͢Δ͸ͳ͠

  44. None
  45. w'VFM1)1ͷૉఢͳงғؾ

  46. w'VFM1)1ͷૉఢͳงғؾ wΠϯετʔϧ͔ΒαΠτදࣔ·Ͱ

  47. w'VFM1)1ͷૉఢͳงғؾ wΠϯετʔϧ͔ΒαΠτදࣔ·Ͱ wͪΐͬͱ͚ͩιʔεͷ͸ͳ͠

  48. ࠓ೔͠ͳ͍͸ͳ͠

  49. ͨ͘͞Μ͋Γ·͢

  50. ۙ͘'VFM1)1ͷೖ໳ॻ͕ ग़൛͞ΕΔΑ͏Ͱ͢

  51. IUUQEIBUFOBOFKQ ,FOKJ@T GVFMQIQ@CPPL@SFWJFXFS

  52. IUUQGVFMQIQ CPPLQIQGPHBQQDPN OPUJGZNF

  53. None
  54. ৄ͘͠͸ͦͪΒͰ

  55. 8IBUJT

  56. None
  57. 'VFM1)1JTBTJNQMF  qFYJCMF DPNNVOJUZESJWFO 1)1XFCGSBNFXPSL CBTFEPOUIFCFTUJEFBTPG PUIFSGSBNFXPSLTXJUIB GSFTITUBSU

  58. None
  59. αΠτ͸ͳΜ͔͓͠ΌΕͳͷʹ

  60. ग़ͯ͘Δ୯ޠ͕ ͍͍ͪͪΨςϯܥ

  61. GVFM

  62. GVFM೩ྉ

  63. GVFM೩ྉ

  64. GVFM೩ྉ

  65. PJM

  66. PJM༉

  67. PJM༉

  68. PJM༉

  69. GPSHF

  70. 7JFXGPSHF  3FTQPOTFGPSHF 

  71. GPSHF஁଄͢Δ

  72. GPSHF஁଄ʢͨΜͧ͏ʣ͢Δ

  73. GPSHFʪమͳͲΛʫ஁͑ͯ ʢۚଐ੡඼ʹʣ͢Δ

  74. GPSHF஁଄͢Δ

  75. GPSHF஁଄͢Δ

  76. GPSHF஁଄͢Δ

  77. Ψςϯܥɺ Ͱ΋ɺͳΜ͔ᔬམͯΔ

  78. None
  79. ͦΜͳงғؾ

  80. ͯ͞ɺग़ձ͍ͷ͸ͳ͠

  81. িܸͷ2VJDL*OTUBMMBUJPO

  82. ͨͬͨͷ̏ߦ

  83. $ curl get.fuelphp.com/oil | sh $ cd Sites/ $ oil

    create blog
  84. ΍ͬͯΈ·͢ʢEFNPʣ

  85. HFUGVFMQIQDPNPJM ͷͳ͔Έ

  86. #!/bin/bash PREFIX="/usr/bin/" install_oil() { sudo sh -c "curl --silent http://get.fuelphp.com/

    installer.sh > ${PREFIX}oil" sudo chmod +x ${PREFIX}oil } # # Handle execution # main() { # Start installation install_oil exit 0 } main
  87. HFUGVFMQIQDPNJOTUBMMFSTI ͷͳ͔Έ

  88. #!/bin/bash if [ -f "./oil" ]; then php oil "$@"

    else if [ "$1" == "create" ]; then if [ ! `which git` ]; then echo "For this installer to work you'll need to install Git." echo ' http://git-scm.com/' fi git clone --recursive git://github.com/fuel/ fuel.git "./$2" php "./$2/oil" refine install else echo 'This is not a valid Fuel installation so Oil is a bit lost.' echo ' http://fuelphp.com/docs/ installation/instructions.html' fi fi
  89. IUUQTHJUIVCDPNGVFMGVFM

  90. IUUQTHJUIVCDPNGVFMGVFM

  91. ͔ͦ͜ΒHJUDMPOF

  92. ͰɺPJMDSFBUFCMPH

  93. None
  94. ͔ͬ͑͜ʔ

  95. ͜͜·ͰΛ·ͱΊ·͢

  96. ͳΜ͔ࠓ෩

  97. HJUIVC

  98. UXJUUFSCPPUTUSBQ

  99. UXJUUFSCPPUTUSBQ

  100. ͳΜ͔ؾ͍͍࣋ͪ

  101. Ϟνϕʔγϣϯҡ࣋ʹ͸ ඇৗʹॏཁ

  102. Ͱ͸ɺதຯΛͦΖͦΖ

  103. None
  104. υΩϡϝϯτ

  105. υΩϡϝϯτ͍ͭͯ͘Δʂ

  106. None
  107. υΩϡϝϯτΈͯΈ·͠ΐ͏

  108. 'VFM1)1ͷ DPSF

  109. ެ։෦෼

  110. ๻ୡ͕ ॻ͘ͱ͜

  111. .7$

  112. .

  113. 7

  114. $

  115. ͜͜͸ 7͡Όͳ͍ʂ

  116. 7JFX.PEFM ࠓ೔͸ ࿩͠·ͤΜ

  117. ࣮͸.PEFMͷ͸ͳ͠΋ ͠·ͤΜ

  118. $POUSPMMFS

  119. ͜͜ʹ഑ஔ

  120. class Controller_Welcome extends Controller { public function action_index() { return

    Response::forge(View::forge('welcome/index')); } }
  121. $POUSPMMFSͷϧʔϧ

  122. None
  123. wQSFpYFEXJUI$POUSPMMFS@

  124. wQSFpYFEXJUI$POUSPMMFS@ wTIPVMEFYUFOEUIF$POUSPMMFSDMBTT

  125. wQSFpYFEXJUI$POUSPMMFS@ wTIPVMEFYUFOEUIF$POUSPMMFSDMBTT wBDUJPO@

  126. wQSFpYFEXJUI$POUSPMMFS@ wTIPVMEFYUFOEUIF$POUSPMMFSDMBTT wBDUJPO@ w"DPOUSPMMFSBDUJPO.645SFUVSOB 3FTQPOTFPCKFDU

  127. class Controller_Welcome extends Controller { public function action_index() { return

    Response::forge(View::forge('welcome/index')); } } QSFpYFEXJUI$POUSPMMFS@
  128. class Controller_Welcome extends Controller { public function action_index() { return

    Response::forge(View::forge('welcome/index')); } } TIPVMEFYUFOEUIF$POUSPMMFSDMBTT
  129. class Controller_Welcome extends Controller { public function action_index() { return

    Response::forge(View::forge('welcome/index')); } } BDUJPO@
  130. class Controller_Welcome extends Controller { public function action_index() { return

    Response::forge(View::forge('welcome/index')); } } "DPOUSPMMFSBDUJPO.645SFUVSO B3FTQPOTFPCKFDU
  131. 63-ͱͷؔ܎

  132. IUUQMPDBMIPTUCMPH QVCMJDXFMDPNFJOEFY

  133. class Controller_Welcome extends Controller { public function action_index() { return

    Response::forge(View::forge('welcome/index')); } } IUUQMPDBMIPTUCMPHQVCMJDXFMDPNFJOEFY
  134. class Controller_Welcome extends Controller { public function action_index() { return

    Response::forge(View::forge('welcome/index')); } public function action_hello() { return Response::forge( View::forge( 'welcome/hello', array('name' => $this->param('name', 'World')) ) ); } } IUUQMPDBMIPTUCMPHQVCMJDXFMDPNFIFMMP
  135. IUUQMPDBMIPTUCMPHQVCMJD

  136. 3PVUJOH

  137. ͜͜ʹ഑ஔ

  138. <?php return array( '_root_' => 'welcome/index', // The default route

    '_404_' => 'welcome/404', // The main 404 route 'hello(/:name)?' => array('welcome/hello'), );
  139. <?php return array( '_root_' => 'welcome/index', // The default route

    '_404_' => 'welcome/404', // The main 404 route 'hello(/:name)?' => array('welcome/hello'), );
  140. IUUQMPDBMIPTUCMPHQVCMJD

  141. IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ

  142. IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ

  143. <?php return array( '_root_' => 'welcome/index', // The default route

    '_404_' => 'welcome/404', // The main 404 route 'hello(/:name)?' => array('welcome/hello'), );
  144. class Controller_Welcome extends Controller { public function action_hello() { return

    Response::forge( View::forge( 'welcome/hello', array('name' => $this->param('name', 'World')) ) ); } } IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ
  145. UIJTQBSBN bIPHF` bEFGBVMU`

  146. UIJTQBSBN bIPHF` bEFGBVMU`

  147. IUUQMPDBMIPTUCMPHQVCMJDIFMMP

  148. class Controller_Welcome extends Controller { public function action_hello() { return

    Response::forge( View::forge( 'welcome/hello', array('name' => $this->param('name', 'World')) ) ); } } IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ
  149. 7JFX

  150. ͜͜ʹ഑ஔ

  151. ͜͜͸ 7͡Όͳ͍ʂ

  152. ͜͜ʹ഑ஔ

  153. σϑΥϧτͰ͸ WJFXϑΝΠϧ͸ੜͷ1)1

  154. ഑ஔ৔ॴʹΑ໊ͬͯલ͕͖·Δ

  155. ྫ͑͹͍ͭ͜

  156. XFMDPNFJOEFY ͱݺͼ·͢

  157. Ͱɺ͖͞΄Ͳͷ

  158. IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ

  159. <body> <div id="header"> <div class="row"> <div id="logo"></div> </div> </div> <div

    class="container"> <div class="row"> <div class="span16"> <h1>Hello, <?php echo $name; ?>! < IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ
  160. class Controller_Welcome extends Controller { public function action_hello() { return

    Response::forge( View::forge( 'welcome/hello', array('name' => $this->param('name', 'World')) ) ); } } IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ
  161. <body> <div id="header"> <div class="row"> <div id="logo"></div> </div> </div> <div

    class="container"> <div class="row"> <div class="span16"> <h1>Hello, <?php echo $name; ?>! < IUUQMPDBMIPTUCMPHQVCMJDIFMMPQIQ
  162. ஋ͷ౉͠ํ

  163. ஋ͷ౉͠ํͦͷ̍ $data = array('title' => 'hoge', 'contents' => 'fuga'); return

    Response::forge(View::forge('welcome/index', $data));
  164. ஋ͷ౉͠ํͦͷ̎ $view = View::forge('welcome/index'); $view->title = 'hoge'; $view->contents = 'fuga';

    return Response::forge($view);
  165. ஋ͷ౉͠ํͦͷ̏ $view = View::forge('home/index'); $view->set('title', 'hoge'); $view->set('contents', 'fuga'); return Response::forge($view);

  166. ϖʔδදࣔͷ͘͠ΈͰͨ͠

  167. $POUSPMMFSҎ֎ͷ$POUSPMMFS

  168. None
  169. w$POUSPMMFS

  170. w$POUSPMMFS w$POUSPMMFS@5FNQMBUF

  171. w$POUSPMMFS w$POUSPMMFS@5FNQMBUF w$POUSPMMFS@3FTU

  172. w$POUSPMMFS w$POUSPMMFS@5FNQMBUF w$POUSPMMFS@3FTU w$POUSPMMFS@)ZCSJE

  173. w$POUSPMMFS w$POUSPMMFS@5FNQMBUF w$POUSPMMFS@3FTU w$POUSPMMFS@)ZCSJE

  174. ϝιουͷQSFpYͰϦΫΤετ ϝιουΛࢦఆ

  175. class Controller_Test extends Controller_Rest { public function get_list() { $this->response(array(

    'foo' => Input::get('foo'), 'baz' => array( 1, 50, 219 ), 'empty' => null )); } } IUUQMPDBMIPTUUFTUMJTUʹHFU
  176. 63-ͰGPSNBUΛࢦఆ

  177. {"foo":"php","baz":[1,50,219],"empty":null} UFTUMJTUKTPO GPPQIQ

  178. <xml> <foo>php</foo> <baz> <item>1</item> <item>50</item> <item>219</item> </baz> <empty/> </xml> UFTUMJTUYNM

    GPPQIQ
  179. "1*࡞੒͕ αΫοͱͰ͖ͯخ͍͠

  180. ΄͔ʹ΋͍͔ͭ͘

  181. w YNMrBMNPTUBOZQSPHSBNNJOHMBOHVBHFDBOSFBE9.- w KTPOrVTFGVMGPS+BWB4DSJQUBOEJODSFBTJOHMZ1)1BQQT w DTWrPQFOXJUITQSFBETIFFUQSPHSBNT w IUNMrBTJNQMF)5.-UBCMF w QIQr3FQSFTFOUBUJPOPG1)1DPEFUIBUDBOCFFWBM

    bFE w TFSJBMJ[Fr4FSJBMJ[FEEBUBUIBUDBOCFVOTFSJBMJ[FEJO1)1
  182. ͬ͟ͱ͜Μͳײ͡Ͱ͢

  183. ͦͷଞʹ΋ͨ͘͞Μ

  184. ॊೈͳ$POpHVSBUJPO

  185. &OWJSPONFOUͷ͸ͳ͠

  186. PJMUFTUHSPVQ"QQ Έ͍ͨͳ͸ͳ͠

  187. %#.PEFM'PSN 7BMJEBUJPO'JFMETFU"VUI 4FTTJPO1BSTFS

  188. υΩϡϝϯτ

  189. None
  190. υΩϡϝϯτ຋༁ϝϯόʔ΋ ืूதͷΑ͏Ͱ͢

  191. None
  192. ͱ͍͏͜ͱͰɺΈͳ͞Μ΋

  193. GVFM೩ྉ

  194. PJM༉

  195. GPSHF஁଄͢Δ

  196. ͋Γ͕ͱ͏͍͟͝·ͨ͠