Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CakePHPでも使える Composerを活用したモダンな開発手法

9b69fbdeb0713def44a8731091ce5885?s=47 Yusuke Ando
September 14, 2013

CakePHPでも使える Composerを活用したモダンな開発手法

PHPカンファレンス2013にて発表

9b69fbdeb0713def44a8731091ce5885?s=128

Yusuke Ando

September 14, 2013
Tweet

Transcript

  1. $PNQPTFSΛ׆༻ͨ͠Ϟμϯͳ։ൃख๏ $BLF1)1Ͱ΋࢖͑Δ

  2. ZBOEP $BOEZ$BOFQIQ ʮ࠙਌ձϐβൃ஫ΞϓϦʯ

  3. 1)1ରԠ1BB4 $IFGͰ"84Λࣗಈߏங $PNQPTFSʹ΋΋ͪΖΜରԠ 44)TVEPՄೳ͔ͭαϙʔτ༗

  4. ΞδΣϯμ Կނ$PNQPTFS͕ඞཁ͔ʁ ࢖͍ํ $BLF1)1ͱ$PNQPTFSͷ૊Έ߹Θͤ

  5. None
  6. $PNQPTFS 1)1 ґଘੑ؅ཧπʔϧ DPNQPTFSίϚϯυͰඞཁͳϥΠϒϥ ϦΛࣗಈతʹूΊͯ͘ΕΔ 4ZNGPOZͷػೳͩͬͨ ݱࡏ͸σϑΝΫτελϯμʔυ

  7. ैདྷͷख๏ ϥΠϒϥϦ͕ඞཁʹͳΔ MJCͱ͔ʹμ΢ϯϩʔυͯ͠ίϐʔ ͕Μ͹ͬͯSFRVJSF@PODF

  8. ໰୊఺ Ξοϓσʔτ͕೉͍͠ ίʔυͷ෼ྔ͕૿͑Δ ϥΠϒϥϦ͕͍ͣΕฤू͞ΕΔ SFRVJSF@PODF஍ࠈ

  9. None
  10. None
  11. None
  12. ͜͏͍͏ͷ͸ྑ͘ͳ͍

  13. $PNQPTFSΛ࢖͓͏ʂ

  14. ࡞Δ΋ͷ 7BHSBOUͰಈ͘ $PNQPTFSͰϥΠϒϥϦΛಋೖ 5XJUUFS͔Β৘ใऔಘ

  15. 7BHSBOU 7JSUVBM#PY7BHSBOU IUUQTHJUIVCDPNZBOEPEQIQ OHJOYWBHSBOUTBNQMF HJUDMPOF WBHSBOUVQ

  16. 

  17. DPNQPTFSKTPO WBHSBOUTTI DEWBHSBOU@EBUBTBOECPY DPNQPTFSKTPOΛهड़͢Δ ࣗಈͰ΋खಈͰ΋Ͱ͖Δ

  18. DPNQPTFSKTPO { "name": "llmatsuri/sample", "authors": [ { "name": "yando", "email":

    "yandod@gmail.com" } ], "require": { "dg/twitter-php": "*" } }
  19. DPNQPTFSKTPO ΄͍͠ϥΠϒϥϦΛݕࡧͯ͠ࢦఆ͢Δ 8FCͰ΋ίϚϯυͰ΋ݕࡧͰ͖Δ ࣮͸1&"3΋ΠϯετʔϧͰ͖Δ ࠷ޙʹDPNQPTFSJOTUBMMͰ·ͱΊͯ%-

  20. DPNQPTFSJOTUBMM vagrant@precise64:/vagrant_data$ composer install Loading composer repositories with package information

    Installing dependencies (including require-dev) - Installing dg/twitter-php (v3.1) Loading from cache Writing lock file Generating autoload files
  21. JOTUBMM͢Δͱ DPNQPTFSMPDL͕ੜ੒͞ΕΔ WFOEPSҎԼʹϥΠϒϥϦ͕%-͞ΕΔ WFOEPSҎԼʹΦʔτϩʔμ͕഑ஔ

  22. ࢖༻ޙ

  23. BVUPMPBE BVUPMPBEQIQ͚ͩΛSFRVJSF͢Δ ඞཁͳ࣌ʹ֤ΫϥεΛࣗಈͰಡΈࠐΉ ೋ౓ͱSFRVJSF@PODFΛॻ͔ͳ͍ ϑϨʔϜϫʔΫ͕ಡΈࠐΉ৔߹΋͋Δ

  24. JOEFYQIQ <?php require_once 'vendor/autoload.php'; $twitter = new Twitter(); ͜Ε͚ͩͰ5XJUUFSΫϥεΛࣗಈతʹ WFOEPSEHUXJUUFSQIQTSD͔ΒಡΈࠐΉʂ

  25. Τϥʔʁ 5XJUUFSΫϥε͸ίϯγϡʔϚΩʔͱ ίϯγϡʔϚγʔΫϨοτ͕ඞཁΒ͍͠

  26. EFWUXJUUFSDPNBQQT αΠϯΞοϓ ΞϓϦΛ࡞੒ ੜ੒͞ΕͨΩʔ৘ใΛίϐͬͯ࢖͏

  27. औಘ <?php require_once 'vendor/autoload.php'; $twitter = new Twitter( 'aaaa', 'bbbb',

    'cccc', 'dddd' ); $info = $twitter->loadUserInfo('yando'); var_dump($info->status->text);
  28. ͓͓ʂ

  29. ͋ͱ͸ ϥΠϒϥϦΛDPNQPTFSKTPO΁௥Ճ DPNQPTFSVQEBUFͰߋ৽ WFOEPSΛίϛοτ͠ͳ͍ σϓϩΠ࣌ʹJOTUBMMͰWFOEPSΛ࠶ੜ

  30. ͞Βʹ 143Λक͍ͬͯΕ͹ࣗ࡞ΫϥεͰ΋ BVUPMPBEʹରԠͰ͖Δ 1&"3ͳͲ΋DPNQPTFSͰΠϯετʔϧ ࣗ࡞ϥΠϒϥϦ΋QBDLHJTUͰެ։ʂ

  31. ࣗ࡞Ϋϥεͷϩʔυ

  32. None
  33. QIQGSJFOET

  34. QIQGSJFOET HJUIVCDPNZBOEPEQIQGSJFOET QIQGSJFOETͷը૾Λऩू ࿩ͷ͖͔͚ͬʹ ʮQIQGSJFOETͷࣸਅࡱΓ·ͤΜ͔ʁʯ SVCZGSJFOETͷύΫϦ

  35. None
  36. ී௨ͷ$BLF MJC$BLFͷԼʹϑϨʔϜϫʔΫ Ξοϓσʔτ͸ؤுͬͯೖସ͑ ϦϙδτϦ͕ඒ͘͠ͳ͍

  37. $PNQPTFSԽ

  38. DPNQPTFSKTPO

  39. ΍Δ͜ͱ DPNQPTFSJOTUBMM DBLFCBLF BQQଆΛࣗಈੜ੒ʂ

  40. ࢼ͢ʁ 7BHSBOUpMF΋ಉ͓͖ࠝͯ͠·ͨ͠ HJUDMPOF WBHSBOUVQ IUUQ

  41. ৄ͘͠͸

  42. ·ͱΊ $PNQPTFSΛ࢖͏ͱ໘౗ͳ࡞ۀ͕ݮΔ ΞοϓσʔτΛසൟʹߦ͍඼࣭޲্ ରԠ͍ͯ͠Δ1BB4ͰͷεϜʔζͳಈ࡞

  43. ࣭໰ طଘΞϓϦͷ$PNQPTFSҠߦ͸ʁ ৽͘͠ಋೖ͢ΔϥΠϒϥϦ͔Βগͮͭ͠Ҡ͠ ͍ͯ͘ͷͰ΋Α͍ɻ ৚݅ʹԠͨ͡ϑϥάͳͲͷઃఆ͸ʁ υΩϡϝϯτΛࢀরɻ IUUQHFUDPNQPTFSPSHEPD TDIFNBNEQBDLBHFMJOLT

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