フレームワークを作りながらLaravelのアーキテクチャを学ぶ / Learn Laravel's architecture while creating a framework

フレームワークを作りながらLaravelのアーキテクチャを学ぶ / Learn Laravel's architecture while creating a framework

F2ab92715fdcc539883d13af4b804ec1?s=128

Futoshi Endo

March 30, 2019
Tweet

Transcript

  1. ԕ౻ଠಙ(.01FQBCP *OD 1)1FS,BJHJ ϑϨʔϜϫʔΫΛ࡞Γͳ͕Β -BSBWFMͷΞʔΩςΫνϟΛֶͿ

  2. ԕ౻ଠಙ ͑ΜͲ͎ʔ !'FOEP 4)ࣄۀ෦(PPQFάϧʔϓ8FCΤϯδχΞ @Fendo181 @Fendo181

  3. ɾ؆୯ʹࣗ෼ͷϗʔϜϖʔδ͕࡞੒Ͱ͖Δ ɾࠓ೥ͰαʔϏεՔಇͯ͠೥໨

  4. ࠓ೥ແࣄʹΞϓϦ͕ϦϦʔε ϞόΠϧ"1*͸-BSBWFMͰ։ൃ

  5. -VNFOͰݎ࿚ͳ"1*Λઃܭ͢Δɻ ͜Ε·Ͱ΍͖ͬͯͨࣄ -BSBWFMΛ࢖ͬͨطଘ8FCαʔϏεͷ"1*Խ

  6.  ͜Ε·Ͱ΍͖ͬͯͨࣄ -BSBWFM+1$POGFSFODFͷίΞελοϑͱͯ͠ࢀՃͯ͠ࢥͬͨࣄΛޠΓ͍ͨ

  7. ࠓ೔͓࿩͍ͨ͠ࣄ

  8. ࠓ೔͓࿩͍ͨ͠ࣄ ൃද಺༰ͷഎܠ 1)1Ͱ.7$ϑϨʔϜϫʔΫΛࣗ࡞ͯ͠ΈΔ  -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ ·ͱΊ

  9. ൃද಺༰ͷഎܠ

  10. ൃද಺༰ͷഎܠ ϑϨʔϜϫʔΫΛ࡞Γͳ͕Β -BSBWFMͷΞʔΩςΫνϟΛֶͿ

  11. ൃද಺༰ͷഎܠ ϑϨʔϜϫʔΫΛ࡞Γͳ͕Β -BSBWFMͷΞʔΩςΫνϟΛֶͿ ͿͬͪΌ͚ɺϑϨʔϜϫʔΫΛ࡞Βͳͯ͘΋ -BSBWFMͷΞʔΩςΫνϟ͸ֶ΂Δ

  12. ൃද಺༰ͷഎܠ  $IBQUFSͰղઆͯ͠·͢ʂ

  13. ൃද಺༰ͷഎܠ ͳͥϑϨʔϜϫʔΫΛ࡞Δͷ͔

  14. ൃද಺༰ͷഎܠ ͳͥϑϨʔϜϫʔΫΛ࡞Δͷ͔ ཧ༝ϑϨʔϜϫʔΫͷϩδοΫΛֶͼ͔ͨͬͨɻ ɾ.7$σβΠϯύλʔϯ ɾ"VUP-PBEFS ɾϧʔςΟϯάͷ࢓૊Έ ɾϏϡʔͷ࢓૊Έ ɾϞσϧͷ࢓૊Έ

  15. ൃද಺༰ͷഎܠ ͳͥϑϨʔϜϫʔΫΛ࡞Δͷ͔ ཧ༝ϑϨʔϜϫʔΫͷϩδοΫΛֶͼ͔ͨͬͨɻ ɾ.7$σβΠϯύλʔϯ ɾ"VUP-PBEFS ɾϧʔςΟϯάͷ࢓૊Έ ɾϏϡʔͷ࢓૊Έ ɾϞσϧͷ࢓૊Έ ཧ༝V[VMMB͞Μ͕೥ʹൃදͨ͠εϥΠυ

  16. ൃද಺༰ͷഎܠ 1)1FSਓੜɺҰ౓͸ϑϨʔϜϫʔΫΛ࡞͓ͬͯ͜͏

  17. ൃද಺༰ͷഎܠ

  18. ൃද಺༰ͷഎܠ ϑϨʔϜϫʔΫ࡞Γ͍ͨͬʂ ೥౰࣌͸·ͩେֶੜ

  19. ൃද಺༰ͷഎܠ ͦΕ͔Β݄೔͕ྲྀΕͯʜ

  20. ൃද಺༰ͷഎܠ ϑϨʔϜϫʔΫ࡞ͬͨͧ ࣾձਓ೥໨ 

  21. ൃද಺༰ͷഎܠ ͳͥ-BSBWFMͷΞʔΩςΫνϟΛֶͿͷ͔

  22. ൃද಺༰ͷഎܠ ͳͥ-BSBWFMͷΞʔΩςΫνϟΛֶͿͷ͔ ཧ༝ )PX खஈ Ͱ͸ͳ͘8IZ ຊ࣭ Λशಘ͔ͨͬͨ͠

  23. ൃද಺༰ͷഎܠ ʲ຋༁ʳzखஈz͸zຊ࣭zΑΓ΋ૣ͘ഇΕΔ

  24. ൃද಺༰ͷഎܠ ϑϨʔϜϫʔΫʹݶఆ͞ΕΔ஌ࣝͱ͍͏ͷ͸ɺഇΕ΍͘͢ɺଞͷٕज़ʹҠߦͰ͖ͳ͍ ϑϨʔϜϫʔΫͰ˓˓͢Δ஌ࣝΛz)PXz खஈ  ϑϨʔϜϫʔΫʹݶఆͤͣଞͷٕज़Ͱ΋ྲྀ༻Ͱ͖Δ஌ࣝΛz8IZz ຊ࣭ 

  25. ൃද಺༰ͷഎܠ ͳͥ-BSBWFMͷΞʔΩςΫνϟΛֶͿͷ͔ ཧ༝ )PX खஈ Ͱ͸ͳ͘8IZ ຊ࣭ Λशಘ͔ͨͬͨ͠ 8IZ ຊ࣭

    ΛֶͿࣄ͸ࠓޙͷΤϯδχΞͱͯ͠΋ ·ͨΞϓϦέʔγϣϯ։ൃʹ͓͍ͯڧΈʹͳΔͱ൑அͨ͠ɻ
  26. 1)1Ͱ.7$ϑϨʔϜϫʔΫΛࣗ࡞ͯ͠ΈΔ

  27. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ࣌ؒͷ౎߹্શͯΛޠΔͷ͸ݫ͍͠ͷͰ ཁ఺͚ͩߜͬͯ஻Γ·͢

  28. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ૣ଎Ͱ͕͢ʜ

  29. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 9೥ ੈք͸ن໿ͷԌʹแ·Εͨ

  30. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ͔͠͠ɺ্࢘͸ ૣ͘γεςϜΛ࡞Εͱ͍͏

  31. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ͦ͜ʹҰਓͷٹੈओ͕ʜ

  32. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ˞ୈষͰࣗ࡞ϑϨʔϜϫʔΫͷ࡞ΓํΛ঺հ͍ͯ͠·͢ɻ

  33. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ΦϨΦϨϑϨʔϜϫʔΫ େߤւ࣌୅ͷນ։͚Ͱ͋Δʜ

  34. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ͱ͍͏ઃఆͰ͓ฉ͖Լ͍͞

  35. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ࡞ΔϑϨʔϜϫʔΫͷ࢓༷ ɾ.7$ύλʔϯ ɾ%#ૢ࡞͕Ͱ͖Δ ɾಈతͳϧʔςΟϯάॲཧ͕Մೳ ɾϨΠΞ΢τϑΝΠϧΛ࢖ͬͨ7JFX

  36. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ɾηογϣϯͷ؅ཧ ɾϩάΠϯػೳ ࣌ؒͷ౎߹Ͱল͔ͤͯ௖͘ॲཧ

  37. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ͻͨ͢Βࣸܦ

  38. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ Ͱ͖ͨͬͬʂʂʂʂ

  39. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 4PLV'SBNFXPSL

  40. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ

  41. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ϑϨʔϜϫʔΫͷίΞͱͳΔػೳ

  42. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ϑϨʔϜϫʔΫͷίΞͱͳΔػೳ Φʔτϩʔυͷ໾ׂΛ࣋ͭ $MBTT-PBEFSQIQ

  43. $MBTT-PBEFS͸ͳͥ͋Δͷ͔ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ

  44. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ $MBTT-PBEFSͷ࢓૊Έ public function register() { spl_autoload_register([$this,'loadClass']); } . (লུ)

    . public function loadClass($class) { foreach ($this->dir as $dir){ $file = $dir . '/' . $class.'.php'; // Tells whether a file exists and is readable if(is_readable($file)){ require $file; return; } } } $MBTT-PBEFSQIQ Ұ෦ൈਮ
  45. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ΫϥεΛݺͼग़͢ࡍʹɺSFRVJSFॻ͔ͳͯ͘΋ ࣗಈͰΫϥεϑΝΠϧΛಡΈ͜Ήࣄ͕Ͱ͖Δ

  46. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ಺෦ͰΫϥεΛಡΈࠐΜͰ͍Δॲཧ͸Ұॹ ࠓճDPNQPTFSKTPO͸࢖Θͳ͍ͷͰεϧʔ

  47. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ "QQMJDBUJPOΫϥεʹϧʔςΟϯάઃఆΛ௥Ճ͢Δ

  48. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ protected function registerRoutes() { return [ '/' => ['controller'

    => 'post', 'action' => 'home'], '/hello' => ['controller' => 'post', 'action' => 'hello'], ]; } $POUSPMMFS໊ "DUJPO໊ ࣮ߦ͢Δϝιου ϧʔςΟϯάઃఆ
  49. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ $POUSPMMFSϑΝΠϧΛ഑ஔ .PEFMϑΝΠϧΛ഑ஔ 7JFXϑΝΠϧΛ഑ஔ

  50. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 7JFXϑΝΠϧΛ഑ஔ "QQMJDBUJPOΫϥεʹϧʔςΟϯάઃఆΛ௥Ճ͢Δ

  51. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ protected function registerRoutes() { return [ '/' => ['controller'

    => 'post', 'action' => 'home'], '/hello' => ['controller' => 'post', 'action' => 'hello'], ]; } $POUSPMMFS໊ "DUJPO໊ ࣮ߦ͢Δϝιου $POUSPMMFS໊͕σΟϨΫτϦʹͳΓ ࢦఆ͕ͳ͚Ε͹"DUJPO໊͕ςϯϓϨʔτϑΝΠϧʹͳΔ ϧʔςΟϯάઃఆ
  52. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ protected function registerRoutes() { return [ '/' => ['controller'

    => 'post', 'action' => 'home'], '/hello' => ['controller' => 'post', 'action' => 'hello'], ]; } $POUSPMMFS໊ "DUJPO໊ ࣮ߦ͢Δϝιου WJFXTDPOUSPMMFS@OBNFBDUJPO@OBNF 7JFXϑΝΠϧͷ໊લղܾϧʔϧ
  53. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ protected function registerRoutes() { return [ '/' => ['controller'

    => 'post', 'action' => 'home'], '/hello' => ['controller' => 'post', 'action' => 'hello'], ]; } $POUSPMMFS໊ "DUJPO໊ ࣮ߦ͢Δϝιου 7JFXϑΝΠϧͷ໊લղܾϧʔϧ
  54. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ protected function registerRoutes() { return [ '/' => ['controller'

    => 'post', 'action' => 'home'], '/hello' => ['controller' => 'post', 'action' => 'hello'], ]; } $POUSPMMFS໊ "DUJPO໊ ࣮ߦ͢Δϝιου 7JFXϑΝΠϧͷ໊લղܾϧʔϧ $POUSPMMFS໊ "DUJPO໊
  55. ΞϓϦέʔγϣϯͷྲྀΕΛ ௥͍ͬͯ͘ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ

  56. શମͷΞϓϦέʔγϣϯͷྲྀΕ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS %C3FQPTJUPSZ 7JFX 3FTQPOTF "QQMJDBUJPO

  57. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ ᶃʮίϝϯτ౤ߘҰཡʯը໘͕ݟ͍ͨ

    શମͷΞϓϦέʔγϣϯͷྲྀΕ
  58. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ϑϩϯτίϯτϩʔϥʔ͕ಡΈࠐ·Εͨࡍʹɺ ΞϓϦέʔγϣϯ͕࣮ߦ͞ΕΔ

  59. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ ΞϓϦέʔγϣϯΫϥε ɾ%#΁઀ଓ͢Δҝͷॳظઃఆ ɾϧʔςΟϯάઃఆ

  60. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ ᶃʮIUUQFYBNQMFDPNQPTUTʯ͕ݟ͍ͨ

    શମͷΞϓϦέʔγϣϯͷྲྀΕ
  61. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ ᶄ(&5Ͱ

    IUUQFYBNQMFDPNQPTUT΁ϦΫΤετ͢Δ 3FRVFTU શମͷΞϓϦέʔγϣϯͷྲྀΕ
  62. %C3FQPTJUPSZ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO 3PVUFS

    ᶅϧʔςΟϯάॲཧ ϦΫΤετͰड͚ͬͨ63-͔Β1"5)@*/'0ΛऔΓग़ͯ͠ $POUSPMMFSͱ"DUJPOΛಛఆ͢Δ શମͷΞϓϦέʔγϣϯͷྲྀΕ
  63. %C3FQPTJUPSZ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO 3PVUFS

    ᶅϧʔςΟϯάॲཧ ϦΫΤετͰड͚ͬͨ63-͔Β1"5)@*/'0ΛऔΓग़ͯ͠ $POUSPMMFSͱ"DUJPOΛಛఆ͢Δ ᶄ(&5Ͱ IUUQFYBNQMFDPNQPTUT΁ϦΫΤετ͢Δ શମͷΞϓϦέʔγϣϯͷྲྀΕ
  64. %C3FQPTJUPSZ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO 3PVUFS

    ᶅϧʔςΟϯάॲཧ ϦΫΤετͰड͚ͬͨ63-͔Β1"5)@*/'0ΛऔΓग़ͯ͠ $POUSPMMFSͱ"DUJPOΛಛఆ͢Δ શମͷΞϓϦέʔγϣϯͷྲྀΕ ᶅϧʔςΟϯάॲཧ ਖ਼نදݱͷʮΩϟϓνϟʯͰϚονͨ͠஋ͱϧʔςΟϯά Λൺֱ͍ͯ͠Δ ᶄ(&5Ͱ IUUQFYBNQMFDPNQPTUT΁ϦΫΤετ͢Δ
  65. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ /** * * PATH_INFOͷ৘ใΛड͚औΓɺϚονͨ͠৔߹ʹarray_mergeͰ$matchesͷத਎Λ$paramsʹϚʔδͯ͠ฦ͢ * * @param $path_info *

    @return array|bool */ public function resolve($path_info) { if(substr($path_info,0,1) !== '/'){ $path_info = '/'.$path_info; } foreach ($this->router as $pattern => $params) { if(preg_match('#^'.$pattern.'$#', $path_info, $matches)){ $params = array_merge($params,$matches); return $params; } } return false; } 3PVUFSQIQ
  66. %C3FQPTJUPSZ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO $POUSPMMFS

    શମͷΞϓϦέʔγϣϯͷྲྀΕ '/posts' => ['controller' => 'post', 'action' => 'posts'],
  67. %C3FQPTJUPSZ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO $POUSPMMFS

    ᶆ$POUSPMMFS ϧʔςΟϯάͰܾΊΒΕͯͨ1PTU$POUSPMMFSΛݺͼग़ͯ͠ QPTUT"DUJPO ϝιου Λ࣮ߦ͢Δɻ '/posts' => ['controller' => 'post', 'action' => 'posts'], શମͷΞϓϦέʔγϣϯͷྲྀΕ
  68. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ // ౤ߘઌҰཡΛऔಘ͢Δ public function postsAction() { $posts = $this->db_manager

    ->get('Post') ->fetchAllPosts(); return $this->render( [ 'posts' => $posts ] ); } 1PTU$POUSPMMFSQIQ
  69. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C.BOBHFS ᶇ%#΁઀ଓΛߦ͏

    %C3FQPTJUPSZ $POUSPMMFS શମͷΞϓϦέʔγϣϯͷྲྀΕ
  70. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C.BOBHFS %C3FQPTJUPSZ

    $POUSPMMFS ᶇ%#΁ΞΫηεΛߦ͏ %# શମͷΞϓϦέʔγϣϯͷྲྀΕ
  71. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C.BOBHFS %C3FQPTJUPSZ

    $POUSPMMFS %# ᶇ%#͔ΒσʔλΛऔಘ͢Δ શମͷΞϓϦέʔγϣϯͷྲྀΕ
  72. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ ᶈ%#͔Βऔಘͨ͠σʔλ

    Λ7JFXʹ౉͢ 7JFX $POUSPMMFS શମͷΞϓϦέʔγϣϯͷྲྀΕ
  73. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ // ౤ߘઌҰཡΛऔಘ͢Δ public function postsAction() { $posts = $this->db_manager

    ->get('Post') ->fetchAllPosts(); return $this->render( [ 'posts' => $posts ] ); } 1PTU$POUSPMMFSQIQ
  74. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ ᶉ7JFXଆͰදࣔ͢ΔIUNM

    ϑΝΠϧΛੜ੒͢Δ $POUSPMMFS 7JFX શମͷΞϓϦέʔγϣϯͷྲྀΕ
  75. ݟग़͕͠ೖΓ·͢ public function renderView($_path, $_variables = [ ], $_layout =

    false) { $_file = $this->base_dir . '/' . $_path . '.php'; extract(array_merge($this->defaults, $_variables)); // Ξ΢τϓοτόοϑΝϦά։࢝ ob_start(); // όοϑΝΛ௒͑ͨ৔߹ʹࣗಈͰϑϥογϡ͢ΔઃఆΛOFFʹ͢Δ ob_implicit_flush(0); // viewϑΝΠϧಡΈࠐΉ require $_file; // $contentʹόοϑΝͨ͠஋ΛೖΕ͍ͯ͘ $content = ob_get_clean(); if ($_layout) { $content = $this->renderView($_layout, array_merge($this->layout_variables, array( '_content' => $content, ) )); } return $content; } 7JFXQIQ
  76. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ 3FTQPOTF

    ᶊΫϥΠΞϯτଆʹ ʮIUUQFYBNQMFDPNQPTUTʯͷը໘Λ Ϩεϙϯεͱͯ͠ฦ͢ શମͷΞϓϦέʔγϣϯͷྲྀΕ
  77. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ .PEFM૚

    $POUSPMMFS૚ 7JFX૚ .7$ύλʔϯ
  78. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ .7$ύλʔϯͷϑϨʔϜϫʔΫΛ࣮૷Ͱ͖ͨ

  79. ·ͱΊ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ

  80. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ .7$ϑϨʔϜϫʔΫΛ࡞ͬͯΈͨ·ͱΊ ɾ ָ͍ͬ͠ʜ ɾ ࣗ෼Ͱ޷͖ͳػೳΛ͙͢ʹ෇͚ΕΔສೳײ ͜Ε͕ΦϨΦϨͷັྗͬʂ ɾΦʔτϩʔυ΍ਖ਼نදݱʹΑΔϧʔςΟϯάॲཧ΍7JFXͰͷ ϨϯμϦϯάͷ࢓૊Έ͕ཧղͰ͖ͨ ɾ໊લղܾ͕ॏཁ

    ɾΦϒδΣΫτࢦ޲ͷษڧͷ୊ࡐʹྑ͍͔΋
  81. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ .7$ϑϨʔϜϫʔΫΛ࡞Δ্Ͱࣄલʹ͋Δͱྑͦ͞͏஌ࣝ ɾ1)14UPSNΛ࢖ͬͯ։ൃ͢Δͷ͕͓קΊɻ ɾFWBM a1TZaTI  ɾσόοάେࣄɻ ɾIUUQTQTZTIPSH ɾςετίʔυ ɾୈষͰ࡞ͬͨ'8Λݕূ͢Δͷ͕ΞϓϦέʔγϣϯΛ࡞͔ͬͯΒ

    ͳͷͰ؆୯ͳςετίʔυΛࣄલʹ࡞͓ͬͯ͘ͱΑΓ࡞Γ΍͍͢Ͱ ͢ɻ
  82. 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ .7$ϑϨʔϜϫʔΫΛ࡞Δ্Ͱࣄલʹ͋Δͱྑͦ͞͏஌ࣝ public function test_resolve() { $pathInfo = 'user/:id'; $params

    = $this->routes->resolve($pathInfo); assertEquals('user',$params['controller']); assertEquals('edit',$params['action']); assertEquals(':id',$params['id']); assertEquals('/user/:id',$params['0']); assertEquals('/;id',$params['1']); }
  83. ୈҰষ׬ ͜͜·Ͱ෼͙Β͍ 1)1Ͱࣗ࡞.7$ϑϨʔϜϫʔΫΛࣗ࡞͢Δ

  84. ࠓ೔͓࿩͍ͨ͠ࣄ ൃද಺༰ͷഎܠ 1)1Ͱ.7$ϑϨʔϜϫʔΫΛࣗ࡞ͯ͠ΈΔ  -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ ·ͱΊ

  85. -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  86. ·ͣ͸-BSBWFMͰ࢖ΘΕ͍ͯΔجຊతͳΞʔΩςΫνϟΛֶͿ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  87. ɾ%FQFOEFODZ*OKFDUJPO ɾ%*ίϯςφ ɾαʔϏείϯςφ ɾϑΝαʔυ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  88. %FQFOEFODZ*OKFDUJPOͱ͸ ґଘੑͷ஫ೖ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  89. %FQFOEFODZ*OKFDUJPOͱ͸ Θ͔ΓͣΒ͍ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  90. %FQFOEFODZ*OKFDUJPOͱ͸ class User { protected $service; public function __construct() {

    $this->service = new Service(); } public function doSomething() { $this->service->sayHi(); } } Class Service { public function sayHi() { echo 'Hi!'; } -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  91. %FQFOEFODZ*OKFDUJPOͱ͸ class User { protected $service; public function __construct() {

    $this->service = new Service(); } public function doSomething() { $this->service->sayHi(); } } Class Service { public function sayHi() { echo 'Hi!'; } 6TFSΫϥε಺Ͱ4FSWJDFΦϒδΣΫτ͕ੜ੒͞Ε͍ͯΔ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  92. %FQFOEFODZ*OKFDUJPOͱ͸ class User { protected $service; public function __construct() {

    $this->service = new Service(); } public function doSomething() { $this->service->sayHi(); } } Class Service { public function sayHi() { echo 'Hi!'; } 6TFSΫϥε಺Ͱ4FSWJDFΦϒδΣΫτ͕ੜ੒͞Ε͍ͯΔ 6TFSΫϥε͸4FSWJDFΦϒδΣΫτʹґଘ͍ͯ͠Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  93. %FQFOEFODZ*OKFDUJPOͱ͸ %*Λͯ͠ͳ͍ύλʔϯͰͷ໰୊ ɾ6TFSΫϥε͸4FSWJDFΫϥε͕ग़དྷΔ·ͰΦϒδΣΫτ͕ੜ੒Ͱ͖ͳ͍ ɾ6TFSΫϥεͰͷ୯ମͷςετΛ͢Δ౓ʹ4FSWJDFΦϒδΣΫτΛ ຖճੜ੒͠ͳ͚Ε͹ͳΒͳ͍ ɾ4FSWJDFΦϒδΣΫτ͔ΒผͷʓʓΦϒδΣΫτʹม͑Δ౓ʹ 6TFSΫϥε͸มߋ͠ͳ͚Ε͹ͳΒͳ͍ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  94. %FQFOEFODZ*OKFDUJPOͱ͸ ղܾࡦ ಺෦ͰΦϒδΣΫτΛੜ੒͢ΔͷͰ͸ͳ͘ ֎෦͔ΒΦϒδΣΫτΛ౉ͯ͋͛͠Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  95. %FQFOEFODZ*OKFDUJPOͱ͸ <?php class User { protected $service; public function __construct(Service

    $service) { $this->service = $service; } public function doSomething() { $this->service->sayHi(); } } Class Service { public function sayHi() { echo 'Hi!'; } } ίϯετϥΫλੜ੒࣌ʹ֎෦͔ΒඞཁͳΦϒδΣΫτΛ஫ೖ͢Δ $POTUSVDUPS*OKFDUJPO -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  96. %FQFOEFODZ*OKFDUJPOͱ͸ $service = new Service(); $user = new User($service); $user->doSomething();

    ίϯετϥΫλੜ੒࣌ʹ֎෦͔ΒඞཁͳΦϒδΣΫτΛ஫ೖ͢Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  97. %FQFOEFODZ*OKFDUJPOͱ͸ ɾந৅ʹґଘͤ͞Δڞ௨ͷΠϯλʔϑΣΠεΛ΋ͨͤΔ ಺෦ͰΦϒδΣΫτΛੜ੒͢ΔͷͰ͸ͳ͘ ֎෦͔ΒΦϒδΣΫτΛ౉ͯ͋͛͠Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ ղܾࡦ

  98. %FQFOEFODZ*OKFDUJPOͱ͸ class User { protected $service; public function __construct(ServiceInterface $service)

    { $this->service = $service; } public function doSomething() { $this->service->sayHi(); } } interface ServiceInterface { public function sayHi(); } Class HogeService implements ServiceInterface { public function sayHi() { echo 'Hi! Hoge!'; } } Class FugaService implements ServiceInterface { public function sayHi() { echo 'Hi! Fuga'; } } ڞ௨ͷ4FSWJDF*OUFSGBDFΛ࡞੒͢Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  99. %FQFOEFODZ*OKFDUJPOͱ͸ class User { protected $service; public function __construct(ServiceInterface $service)

    { $this->service = $service; } public function doSomething() { $this->service->sayHi(); } } interface ServiceInterface { public function sayHi(); } Class HogeService implements ServiceInterface { public function sayHi() { echo 'Hi! Hoge!'; } } Class FugaService implements ServiceInterface { public function sayHi() { echo 'Hi! Fuga'; } } ֤ΫϥεͰ4FSWJDF*OUFSGBDFΛ࣮૷͢Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  100. class User { protected $service; public function __construct(ServiceInterface $service) {

    $this->service = $service; } public function doSomething() { $this->service->sayHi(); } } interface ServiceInterface { public function sayHi(); } Class HogeService implements ServiceInterface { public function sayHi() { echo 'Hi! Hoge!'; } } Class FugaService implements ServiceInterface { public function sayHi() { echo 'Hi! Fuga'; } } ServiceInterfaceΛλΠϓώϯτͤͯ͞ $POTUSVDUPS*OKFDUJPOͤ͞Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ %FQFOEFODZ*OKFDUJPOͱ͸
  101. %FQFOEFODZ*OKFDUJPOͱ͸ // HogeService $service = new HogeService(); $user = new

    User($service); $user->doSomething(); #Hi! Hoge! // FugaService $service = new FugaService(); $user = new User($service); $user->doSomething(); #Hi! Fuga ֎෦͔Βґଘ͢ΔΦϒδΣΫτ஫ೖ͚ͩͰྑ͍ʂ ݩͷ6TFSΫϥεʹมߋ͸ى͖ͳ͍ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  102. %FQFOEFODZ*OKFDUJPOͱ͸ ґଘੑͷ஫ೖ ඞཁͳΦϒδΣΫτ Λ֎෦͔Β஫ೖ͢Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  103. %*׬શʹཧղͨ͠ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  104. ɾ%FQFOEFODZ*OKFDUJPO ɾ%*ίϯςφ ɾαʔϏείϯςφ ɾϑΝαʔυ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  105. %*ίϯςφͱ͸ // HogeService $service = new HogeService(); $user = new

    User($service); $user->doSomething(); ͭͱ͔ͩͬͨΒ·ͩࠔΒͳ͍ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  106. %*ίϯςφͱ͸ $service1 = new Service1(); $service2 = new Service2(); $service3

    = new Service3(); $user = new User($service1,$service2,$service3); $user->doSomething(); ֎෦͔Β஫ೖ͢ΔΦϒδΣΫτ͕ଟ͗ͯ͢ɺґଘؔ܎ ͕ෳࡶʹͳΓੜ੒͕େมʹͳͬͯ͘Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  107. %*ίϯςφͱ͸ %*ίϯςφ͸͜ͷ໰୊ΛҎԼͷํ๏Ͱղܾͤ͞Δπʔϧ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  108. %*ίϯςφͱ͸ %*ίϯςφ͸͜ͷ໰୊ΛҎԼͷํ๏Ͱղܾͤ͞Δπʔϧ %*ίϯςφͰΦϒδΣΫτੜ੒ͷํ๏ΛࣄલʹܾΊ͓ͯ͘ ΠϯελϯεΛ%*ίϯςφଆ͔Βऔಘ͢Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  109. use Pimple\Container; $container = new Container(); $container['service1'] = function($c){ return

    new Service1(); }; $container['service2'] = function ($c){ return new Service2(); }; $container['service3'] = function ($c){ return new Service3(); }; $container['user'] = function($c) { return new User($c['service1'], $c['service2'], $c['service3']); }; ࣄલʹΠϯελϯεͷੜ੒ํ๏Λొ࿥͓ͯ͘͠ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  110. use Pimple\Container; $container = new Container(); $container['service1'] = function($c){ return

    new Service1(); }; $container['service2'] = function ($c){ return new Service2(); }; $container['service3'] = function ($c){ return new Service3(); }; $container['user'] = function($c) { return new User($c['service1'], $c['service2'], $c['service3']); }; Πϯελϯεੜ੒࣌ʹґଘؔ܎Λղܾͤ͞ΔΑ͏ʹ͢Δ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  111. %*ίϯςφͱ͸ $service1 = new Service1(); $service2 = new Service2(); $service3

    = new Service3(); $user = new User($service1,$service2,$service3); $user->doSomething(); #FGPSF -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  112. %*ίϯςφͱ͸ //$service1 = new Service1(); //$service2 = new Service2(); //$service3

    = new Service3(); // //$user = new User($service1,$service2,$service3); $user = $container['user']; $user->doSomething(); "GUFS -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  113. %*ίϯςφͱ͸ ɾΠϯελϯεੜ੒͔ΒखಈͰ$POTUSVDUPS*OKFDUJPO͍ͯͨ͠εςοϓ͕ ͨͬͨߦʹͳͬͨʂʂʂ ཪଆͰ͸%*ίϯςφͰΦϒδΣΫτΛ؅ཧ͍ͯ͠Δҝ  ɾ%*ίϯςφʹΠϯελϯεͷੜ੒ํ๏Λొ࿥͠ͱ͍ͨͷͰɺ%*ίϯςφ ܦ༝ͰΠϯελϯεΛͲ͔͜ΒͰ΋ݺͼग़͢ࣄ͕Ͱ͖Δ ґଘؔ܎͸ີด͞Εͨঢ়ଶ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  114. ͜͜·Ͱͷ·ͱΊ %FQFOEFODZ*OKFDUJPOͱ͸ ඞཁͳΦϒδΣΫτΛ֎෦͔Β஫ೖ͢Δ σβΠϯύλʔϯͷͭ %*ίϯςφͱ͸ ࣄલʹΦϒδΣΫτͷੜ੒ํ๏Λొ࿥͓ͯ͘͠ ࣄͰɺґଘؔ܎ͷղܾͱΦϒδΣΫτͷੜ੒Λ ಉ࣌ʹߦͬͯ͘ΕΔπʔϧ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  115. %*ίϯςφ׬શʹཧղͨ͠ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  116. Ͱ͸ɺαʔϏείϯςφͱ͸ʁ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  117. αʔϏείϯςφͱ͸ -BSBWFMͰఏڙ͍ͯ͠Δ%*ίϯςφ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  118. αʔϏείϯςφͱ͸ -BSBWFMͰఏڙ͍ͯ͠Δ%*ίϯςφ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  119. αʔϏείϯςφͱ͸ -BSBWFMͰఏڙ͍ͯ͠Δ%*ίϯςφ Πϯελϯεͷੜ੒ํ๏Λొ࿥͢ΔˠCJOECJOEJOH ࢦఆ͞ΕͨΠϯελϯεΛ αʔϏείϯςφ͕ੜ੒ͯ͠ฦ͢ˠSFTPMWFSFTPMWJOH -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  120. αʔϏείϯςφͱ͸ ྫ TJOHMFUPOϝιου αʔϏείϯςφͰΠϯελϯεͷੜ੒ํ๏Λొ࿥͓ͯ͘͠ͱɺ͔࣍ΒΩϟογϡ ͞ΕͨΠϯελϯε͕ฦ͞Ε·͢ɻ $container->singleton('TwitterClient',function() { return new TwitterClient();

    }); $tweet1 = $container->make('TwitterClient'); $tweet2 = $container->make('TwitterClient'); if($tweet1 === $tweet2){ echo 'true'; #true } -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  121. ͜͜·Ͱͷ·ͱΊ αʔϏείϯςφͱ͸ -BSBWFM͕ఏڙ͢Δ%*ίϯςφ πʔϧ Πϯελϯεͷੜ੒ํ๏ CJOE ΍αʔϏείϯ ςφ͔ΒΠϯελϯεΛऔಘ SFTPMWF ͢Δଟ࠼

    ͳػೳΛఏڙ͢Δɻ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  122. ɾ%FQFOEFODZ*OKFDUJPO ɾ%*ίϯςφ ɾαʔϏείϯςφ ɾϑΝαʔυ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  123. ϑΝαʔυͱ͸ ɾfacades !== facade pattern -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  124. ϑΝαʔυͱ͸ 3FTQPOTF%PO`U6TF'BDBEFT -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  125. ϑΝαʔυͱ͸ ʲ຋༁ʳ%PO`U6TF'BDBEFTʹର͢Δճ౴ ϑΝαʔυ͸ɺαʔϏεͷ৔ॴΛදͨ͢Ίͷ౶ҥߏจ TZOUBDUJDTVHB Ͱ͋ΔͨΊ؆୯ ʹͲ͔͜ΒͰ΋ݺͼग़͢ࣄ͕Ͱ͖·͢ɻϑΝαʔυΛݺͼग़͢ͱɺϑΝαʔυ͸-BSBWFMͷ αʔϏείϯςφ͔ΒجૅͱͳΔΫϥεղܾ͠ɺΠϯελϯε্Ͱ໨తͷϝιουΛݺͼ ग़͠·͢ɻςετίʔυ͕ॻ͖΍͍͢ػೳΛఏڙͭͭ͠ɺඇৗʹ؆ܿͰදݱྗͷ͋Δػೳ Λఏڙ͠·͢ɻ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  126. ϑΝαʔυͱ͸ ʲ຋༁ʳ%PO`U6TF'BDBEFTʹର͢Δճ౴ ϑΝαʔυ͸ɺαʔϏεͷ৔ॴΛදͨ͢Ίͷ౶ҥߏจ TZOUBDUJDTVHB Ͱ͋ΔͨΊ؆୯ ʹͲ͔͜ΒͰ΋ݺͼग़͢ࣄ͕Ͱ͖·͢ɻϑΝαʔυΛݺͼग़͢ͱɺϑΝαʔυ͸-BSBWFM ͷαʔϏείϯςφ͔ΒجૅͱͳΔΫϥεղܾ͠ɺΠϯελϯε্Ͱ໨తͷϝιουΛݺ ͼग़͠·͢ɻςετίʔυ͕ॻ͖΍͍͢ػೳΛఏڙͭͭ͠ɺඇৗʹ؆ܿͰදݱྗͷ͋Δػ ೳΛఏڙ͠·͢ɻ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  127. ΜɺαʔϏείϯςφʁ ϑΝαʔυͱ͸ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  128. ϑΝαʔυͱ͸  $debug = \Config::get(‘app.debug’); ᶃϑΝαʔυΫϥε $POpH ͷղܾ ˣ ᶄϑΝαʔυΫϥεͷΫϥεϝιου࣮ߦ

    ˣ ᶅαʔϏείϯςφ͔ΒΠϯελϯεऔಘ ˣ ᶆΠϯελϯεϝιουͷ࣮ߦ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  129. ϑΝαʔυͱ͸ ΫϥεϝιουܗࣜͰͲ͔͜ΒͰ΋Πϯελϯεϝιου ݺͼग़ͤΔػೳ ɾ3FRVFTU ɾ$POpH ɾ$BDIF ɾ ɾ ɾ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  130. ׬શʹཧղͨ͠ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  131. ͱ͍͏ࣄͰʜ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  132. ೥ ੈք͸-BSBWFMʹแ·Ε͍ͯͨ ओʹQIQFSք۾Ͱ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  133. 3FRVFTU 3PVUFS $POUSPMMFS %C.BOBHFS 7JFX 3FTQPOTF "QQMJDBUJPO %C3FQPTJUPSZ .PEFM૚ $POUSPMMFS૚

    7JFX૚ .7$ύλʔϯ Y೥ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  134. 3FRVFTU 3PVUFS $POUSPMMFS 7JFX 3FTQPOTF -BSBWFM .PEFM .PEFM૚ $POUSPMMFS૚ 7JFX૚

    -BSBWFMͷ.7$ύλʔϯ ೥ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  135. Կ͕มΘͬͨͷ͔ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  136. 3FRVFTU 3PVUFS $POUSPMMFS 7JFX 3FTQPOTF -BSBWFM .PEFM .PEFM૚ $POUSPMMFS૚ 7JFX૚

    -BSBWFMͷ.7$ύλʔϯ ೥ facades -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ
  137. ֤ػೳ͕ϑΝαʔυͰݺ͹Ε͍ͯΔʂ ϑΝαʔυ͸αʔϏείϯςφܦ༝ͰΠϯελ ϯεΛݺͼग़͢ҝͲ͔͜ΒͰ΋࣮ߦՄೳ ґଘؔ܎Λղܾͯ͠ૄ݁߹ʹͯ͘͠ΕΔ ςετ͕ॻ͖΍͍͢ʂ֦ு͠΍͍͢ʂ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  138. -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ ϑΝαʔυ͍͍͡ΌΜʂ

  139. ϑΝαʔυ͍͍͡ΌΜʂ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  140. ϑΝαʔυܯ࡯ʹౖΒΕ·͢ ϑΝαʔυܯ࡯ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  141. %*ίϯςφͱ͸ ɾΠϯελϯεੜ੒͔ΒखಈͰ$POTUSVDUPS*OKFDUJPO͍ͯͨ͠ εςοϓ͕ͨͬͨߦʹͳͬͨʂʂʂ ཪଆͰ͸%*ίϯςφͰΦϒδΣΫτΛ؅ཧ͍ͯ͠Δҝ  ศརͰ͋Δ͕ɺٯʹґଘؔ܎͕෼͔ΓͮΒ͘ͳΔ ɾ%*ίϯςφʹΠϯελϯεͷੜ੒ํ๏Λొ࿥͠ͱ͍ͨͷͰɺ%*ίϯςφ ܦ༝ͰΠϯελϯεΛͲ͔͜ΒͰ΋ݺͼग़͢ࣄ͕Ͱ͖Δ ґଘؔ܎͸ີด͞Εͨঢ়ଶ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  142. l͔͠͠ͳ͕ΒαʔϏͷ։ൃʹ͓͍ͯ͜Ε͸ѱ͍ઃܭʹಋ͕࣌͋͘Γ·͢ɻ  ͨͱ͑͹ɺ͜ͷϑΝαʔυΛ௥Ճ͢Δͷ͸ʮ؆୯ʯͳͷͰɺΫϥεͰ੹຿͕૿͑ΔՄೳੑ͕͋Γ·͢ɻ ҰൠతʹΫϥεΛ࡞Δࡍ͸ɺཧղͷ͠΍͢΍ɺςετɺσόοΫͳͲΛ༏ઌ͢Δҝɺ ੹೚Λूத͠খ͘͞ͳΔΑ͏ʹ࡞Δࣄ͕๬·Ε·͢ɻ 'BDBEFTΛ࢖༻ͯ͠Ωϡʔʹϓογϡ͠ɺిࢠϝʔϧΛૹ৴͠ɺ͢΂ͯͷσʔλΛݕূ͢Δͱݴͬͨ੹຿Λ୯ҰͷΫϥε ΊࠐΉͱɺͦͷΫϥεͷத৺తͳ੹೚͸ෆ໌ྎͰ͢ɻ ͦΕ͸΍Γ͗ͩ͢ͱ৺഑͍ͯ͠·͢ɻz ʲ຋༁ʳ%PO`U6TF'BDBEFTʹର͢Δճ౴ -BSBWFMͷΞʔΩςΫνϟΛֶͼɺࣗ࡞'8ͱൺֱͯ͠ΈΔ

  143. ·ͱΊ -BSBWFMͰఏڙ͍ͯ͠ΔػೳͷݩΛΈΕ͹αʔϏείϯςφͰ ศརͳػೳΛΫϥεϝιουͰݺͼग़ͤΔ࢓૊ΈΛఏڙ͍ͯ͠Δ ϑϨʔϜϫʔΫͱ͍͏ࣄΛվΊͯೝࣝͨ͠ ͔͠͠ɺϑΝαʔυ͸Ͳ͜Ͱ΋ར༻Ͱ͖Δ͕ނʹෳࡶʹͳΓқ͍ -BSBWFMͷجຊతͳΞʔΩςΫνϟͰ͋Δ %*ɺαʔϏείϯςφ %*ίϯςφ ɺ'BDBEFTΛཧղͨ͠

  144. ·ͱΊ

  145. ͳͥ-BSBWFMͷΞʔΩςΫνϟΛֶͿͷ͔ ཧ༝ )PX खஈ Ͱ͸ͳ͘8IZ ຊ࣭ Λशಘ͔ͨͬͨ͠ ·ͱΊ

  146.  )PX खஈ Ͱ͸ͳ͘ɺ8IZ ຊ࣭ ΛֶͿࣄ͸ ݴޠ΍ಛఆͷϑϨʔϜϫʔΫʹґଘ͠ͳ͍ҝࠓޙͷΞϓϦέʔγϣϯ։ൃʹ͓͍ͯ ઃܭ͢Δࡍͷྑ͍ࢦඪͱͳΔࣄΛ֬৴ͨ͠ʂ ·ͱΊ

  147. ͱ͸͍͑ɺݱ࣮ੈքͰ͸Ϣʔβʹૣ͘Ձ஋Λఏڙ͢Δʹ͸ )PX खஈ ͷ஌ࣝ΋౰વඞ༻ͩͱཧղ͍ͯ͠Δɻ ͔͠͠ɺ8IZ ຊ࣭ Λཧղ͢Δࣄ͸݁Ռతʹ)PX खஈ ͷॿ͚ʹͳΔҝɺ Ϣʔβͷྑ͍Ձ஋Λૣ͘ఏڙ͚ͨ͠Ε͹8IZ

    ຊ࣭ Λཧղ͢Δࣄ΋ॏཁɻ ·ͱΊ
  148. 8IZ ຊ࣭ Λ௥͍ٻΊͯɺྑ͍ΤϯδχΞ΁ͷҰา΁ ͱ͸͍͑ɺݱ࣮ੈքͰ͸Ϣʔβʹૣ͘Ձ஋Λఏڙ͢Δʹ͸ )PX खஈ ͷ஌ࣝ΋౰વඞ༻ͩͱཧղ͍ͯ͠Δɻ ͔͠͠ɺ8IZ ຊ࣭ Λཧղ͢Δࣄ͸݁Ռతʹ)PX

    खஈ ͷॿ͚ʹͳΔҝɺ Ϣʔβͷྑ͍Ձ஋Λૣ͘ఏڙ͚ͨ͠Ε͹8IZ ຊ࣭ Λཧղ͢Δࣄ΋ॏཁɻ ·ͱΊ
  149. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ ϓϩϑΟʔϧGFOEP1SPpMF