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

PHP5.5、いつやるか?今でしょ!

4b110d33674fe1a45080f5ddf77809e0?s=47 Keisuke SATO
September 14, 2013

 PHP5.5、いつやるか?今でしょ!

オープンソースカンファレンス2013 Hokkaido
https://www.ospn.jp/osc2013-do/modules/eguide/event.php?eid=29

w/ Sapporo.php

4b110d33674fe1a45080f5ddf77809e0?s=128

Keisuke SATO

September 14, 2013
Tweet

Transcript

  1. Sapporo.php PHP5.5 ͍ͭ΍Δ͔ʁ ࠓͰ͠ΐʂ ΦʔϓϯιʔεΧϯϑΝϨϯε2013 ๺ւಓ ࠤ౻ Ղ༞ ( Sapporo.php

    )
  2. ͋ͨΒ͍͠1)1ͷ৘ใʹৄ͍͠ɻ ࠤ౻Ղ༞ઌੜʢҰൠࣾஂ๏ਓ-0$"-ʣ

  3. ͓Θͼ ࠷ॳ͸ʮPHP5.5 Updateʯ͍ͬͯ͏λΠτϧͰ ΍Δ༧ఆͩͬͨΜͰ͚͢Ͳɺʮ΋͏গ͠ώΩ͕ ͋Δ΄͏͕͍͍ʯͱݴΘΕ·ͯ͠ɺ͍΍͍΍ PHP5.5 ͷ࿩ʹʮͻ͖ʯͬͯݴΘΕ·ͯ͠΋... Έ͍ͨͳײ͡ͰͱΓ͋͑ͣྲྀߦʢ஗Εʣʹͷͬ ͯΈͨͱ͜ΖͰݩωλͦΕ΄Ͳৄ͘͠ͳ͍ͷͰ ͍ͭ΋Ͳ͓Γਐߦ͠·(ུ

  4. ͓Θͼ ͪΐͬͱඓ੠ + ࡢ೔༡ͼա͗Ͱ੠͕͓͔͍͠Ͱ ͢ɻฉ͖औΓʹ͍࣌͘͸ԕྀແ͘ฉ͖ฦͯ͘͠ ͍ͩ͞ɻ͝ΊΜͳ͍͞ɻ΄Μͱɺ͝ΊΜͳ͞ ͍ɻ

  5. ࠤ౻Ղ༞ ๺ւಓ۴࿏ொग़਎ɺ౦ژ౎ࡏॅ ೥݄೔ੜ !SJBG GCNFTBUPLFJTVLF Ұൠࣾஂ๏ਓ-0$"- ೔ຊ1)1Ϣʔβʔձ

  6. PHP ͱ΅͘ •ߴߍͷࠒ͔Β͞Θ͍ͬͯΔͷͰͳʹ͛ ʹ 10 ೥Ҏ্... •Openpear ͱ͔ͭ͘Γ·ͨ͠ •Xoops, Ethna,

    rhaco, Symfony, ...
  7. Today

  8. ͋Εɻ͍ͪ͹Μͷཪ൪૊ͳͷͰ͸ʁ

  9. None
  10. ͪͳΈʹࠓ౦ژͰ͸ • MySQL Admin͕ݟͨDevsͷৗࣝɺDBA͸ඇৗࣝ • 15෼Ͱग़དྷΔPHPͱJavaScript MVCϑϨʔϜϫʔΫ Ͱ࡞ΔϓϩτλΠϓ • PHP

    5.5ωʔςΟϒΩϟογϡͷ࿩ • ϑϩϯτΤϯυ੍࡞޲͚ϏϧυπʔϧGruntΛPHP όοΫΤϯυ։ൃͰར༻͢Δ • PHP։ൃऀͷͨΊͷΫϥ΢υ؀ڥ -ೖ໳ฤ-
  11. Agenda •PHP ͷΞοϓσʔτ৘ใ •Composer / Packagist •PSR, php-fig ٧ΊࠐΈ͗ͯ͢આ໌͚ͩʹͳͬͯ͠·͍ͦ͏Ͱ͢ ୀ۶͔΋͠Εͳ͍Ͱ͕͢ɺ͝ΊΜͳ͍͞ɻ

  12. ͬͦ͘͞Ͱ͕͢

  13. ͋ͳ͕͓ͨ࢖͍ͷ1)1ͷόʔδϣϯ͸ʁ php -v

  14. 4.* 5.0.* 5.1.* 5.2.*

  15. ͢ͰʹηΩϡϦςΟαϙʔτ΋ ऴ͍ྃͯ͠·͢ɻ ࠓ͙͢ʹΞοϓσʔτ͠·͠ΐ͏ɻ ͍ͭ΍Δ͔ʁ ΋͏͓ͤʔΑʂ

  16. 5.3.*

  17. ࣮͸ php5.3 ΋དྷ೥6݄Ͱαϙʔτऴྃ͠·͢ 7݄ʹϦϦʔε͞ΕͨPHP 5.3.27 ͕ 5.3 ܥ࠷ޙ ͷ௨ৗΞοϓσʔτͱͳΓɺαϙʔτऴྃ· ͰηΩϡϦςΟରԠ͔͠ߦΘΕ·ͤΜɻ

  18. ͭ·Γɺphp5.5 ΁ͷΞοϓσʔ τΛߟ͑ΔλΠϛϯά͸·͞ʹ

  19. ͭ·Γɺphp5.5 ΁ͷΞοϓσʔ τΛߟ͑ΔλΠϛϯά͸·͞ʹ ࠓ

  20. ͍΍͍΍ɺͦ͏͸ݴͬͯ΋ݱঢ়ಈ͍ͯΔ͠Ͷ͐...ʁ ͱࢥͬͨ ͦ͜ͷ͋ͳͨʂ

  21. ڈ೥ • CGI ϞʔυͰಈ࡞͢Δ PHP ʹίϚϯυϥΠϯ Φϓγϣϯ͕ΫΤϦετϦϯάͰࢦఆͰ͖ͯ ͠·͏੬ऑੑ͕ • .../hoge.php?-s

    • ιʔείʔυ͕γϯλοΫεϋΠϥΠτ͞Ε ͯݟ͑ͪΌ͍ͬͯͨ • ͪͳΈʹ Facebook ʹ -s ͚ͭͯΞΫηε͢Δͱٻਓ৘ใͷ URL ͕࢓ ࠐ·Εͨ php ίʔυΛදࣔͯ͠·ͨ͠ɻ
  22. ͦͷ΄͔ʹ΋ wDSZQUͷόά  wSBTNVT w)551ϔομΠϯδΣΫγϣϯ Ҏ લͷIFBEFSؔ਺ wIBTIEPT ·͋͜Ε͸ઃఆͷ໰୊ wͳͲͳͲ

  23. PHP ͕໰୊ʹͳΔέʔεɺ ͦΕͳΓʹ͋Γ·͢ɻ

  24. ࠷௿Ͱ΋ • 5.3.2 ͱ͔ɺத్൒୺ͳόʔδϣϯΛ࢖Θͣ ʹɺ࠷৽όʔδϣϯ (5.3.27) ͱ͔ɺϚΠφʔΞ οϓσʔτ͸͢΂ͯద༻͓ͯ͘͠ • Ͳ͏ͯ͠΋ݹ͍όʔδϣϯ͕ඞཁͳͱ͖͸ɺ

    ͲͷΑ͏ͳ໰୊Λ๊͍͑ͯΔͷ͔೺Ѳ͢Δ ʢ໰୊͕ൃੜ͢ΔͳΒमਖ਼͢Δʣ
  25. PHP 5.4 ͷ͓͞Β͍

  26. PHP 5.3 ͷ͓͞Β͍ ͦͷ·͑ʹɺ͚ͩ͢͜͠

  27. 5.3 ͷ৽ػೳ •໊લۭؒ •஗Ԇ੩తଋറ •goto... •ωΠςΟϒΫϩʔδϟʢແ໊ؔ਺ʣ •__callStaticɺ__invoke ϚδοΫϝιο υͷ௥Ճ

  28. 5.3 ͷ৽ػೳ •Nowdoc •Ϋϥε֎Ͱͷ const Ωʔϫʔυ •?: ʢࡾ߲ԋࢉࢠͷ୹ॖʣ •੩తϝιουʹಈతΞΫηεʢ$a::$b) •ྫ֎ͷωετ

  29. ৽ػೳ͚ͩͰ੝Γͩ͘͞Μ

  30. 5.3 ͦͷଞʹ΋ •52 ͷ৽͍ؔ͠਺ •18 ͷ৽͍͠ύϥϝʔλରԠͷؔ਺ •18 ͷ৽͍͠ϝιου •18 ͷ৽͍͠Ϋϥε

  31. PHP 5.4 ͷ͓͞Β͍

  32. 5.4 ͷ৽ػೳ •τϨΠτ •഑ྻͷ୹ॖߏจ •<?= ͕ৗʹ༗ޮʹ •foo()[1] •(new Foo)->bar() •built-in

    webserver
  33. ηʔϑϞʔυͷഇࢭ • 5.3 ͔Βඇਪ঑Ͱͨ͠

  34. ϚδοΫΫΦʔτͷഇࢭ • 5.3 ͔Βඇਪ঑Ͱͨ͠ • ͪΌΜͱΤεέʔϓ͠·͠ΐ͏Ͷ

  35. register_globals ഇࢭ • ࠓߋ࢖ͬͯͳ͍ͱ͸͓΋͍·͕͢ɻ • register_long_arrays ΋ഇࢭ͞Εͯ·͢ɻ • $_HTTP_*_VARS తͳ΍ͭ

    • extract($_REQUEST) ͢ΓΌ͍͍ͬͯ͜ͱͰ͸ ͳ͍Ͱ͢Αɻ͖ͪͬͱѻ͍·͠ΐ͏Ͷɻ
  36. Call-time pass-by-reference ഇࢭ • ݺͼग़࣌͠ͷࢀর౉͠ • foo(&$bar)

  37. date.timezone ઃఆඞਢ • TZ ؀ڥม਺Λࢀর͠ͳ͘ͳͬͨ • date_default_timezone_set() • ઃఆ͠ͳ͍ͱ UTC

    ʹͳͬͯ Warning ͕ൃੜ
  38. 5.4 Ͱ͸ɺ·ͱ΋ͳਐԽ͕ɻ

  39. ᠘ • apc ͕ΠϚΠν • ฐࣾαʔϏε΋Α͘ apc ͷ͍ͤͰίέ·͢ • OPcache

    Λ࢖͏ͱ҆ఆͦ͠͏ͳ༧ײ • ςετ؀ڥͰ͸໰୊ͳ͘ಈ͍͍ͯΔ • ·ͩ production ʹ͸͍Εͯ·ͤΜ • ͋ͱͰ·ͨઆ໌͠·͢Ͷ
  40. ͯ͞ɺ5.5 Ͱ͸

  41. 5.5 ͷ৽ػೳ

  42. δΣωϨʔλͷ௥Ճ • yield Ωʔϫʔυ

  43. finally Ωʔϫʔυͷ௥Ճ • ԿΛ͍·͞Β... • try .. catch .. finally

  44. password_* ؔ਺ • ύεϫʔυͷѻ͍Λ؆୯ʹ • ݱࡏ͸ bcrypt ͷΈରԠ

  45. foreach now support list()

  46. empty ͕೚ҙͷࣜʹରԠ • ͡Έʹ͏Ε͍͠

  47. array, string ͷσϦϑΝϨϯε

  48. ::class • ClassName::class Ͱ namespace ΛؚΉΫϥε ໊ΛऔಘͰ͖ΔΑ͏ʹ

  49. OPcache extension • Zend Optimizer+ ͷΦϖίʔυΩϟογϡ • ΋ͱ΋ͱ༗ྉͰఏڙ͞Εͯͨ΍ͭͰ͢ • ։ൃ൛Ͱ͸

    apc ΑΓ਺% ʙ 20 % ΄Ͳߴ଎ • apc ͸ 5.5 ޲͚ʹ͸ఏڙ͞Ε͍ͯ·ͤΜ • apc_store, apc_fetch ͳͲͷ KVS ػೳ͚ͩ Λఏڙ͢Δ apcu extension ͕͋Γ·͢
  50. ͦͷଞ • foreach ͕ඇεΧϥʔͷΩʔʹରԠ • ωΠςΟϒͷ഑ྻ͸εΧϥʔͷΈ • Iterator::key() ͕೚ҙͷ஋ΛฦͤΔ •

    Apache 2.4 ϋϯυϥ͕ Windows ʹରԠ • GD ͷվྑ
  51. มߋ఺ϐοΫΞοϓ

  52. Deprecated • preg_replace ͷ /e म০ࢠ • ͔ΘΓʹ preg_replace_callback Λ

    • ҙ֎ͱϋϚΓͲ͜ΖɻErrorException Ͱɻ • ext/mysql extension • ͔ΘΓʹ mysqli ͔ pdo_mysql Λ
  53. ͦͷଞ • Windows XP / 2003 ͷαϙʔτऴྃ • pack /

    unpack ͷԼҐޓ׵ੑͷͳ͍มߋ
  54. None
  55. Composer • PHP 5.3.2 ͔Β࢖͑Δύοέʔδ؅ཧπʔϧ • Ruby Ͱ͍͏ Bundler, node

    Ͱ͍͏ npm త ͳ΍ͭ • composer.json / autoload.php • Symfony, Zend Framework, PHPUnit, ... • git ͸ඞਢ͔΋ɻ • ϩΰ͕͍ͩ͞
  56. Packagist • Composer ඪ४ϦϙδτϦ • ͩΕͰ΋ొ࿥Ͱ͖·͢ • 15,000 ύοέʔδҎ্ʂ •

    PEAR ͸ 600 ऑ • ೦ئͷύοέʔδ਺ʂ
  57. PSR php-fig

  58. PSR • ༗໊ϑϨʔϜϫʔΫ࡞ऀͨͪͰߏ੒͞ΕΔ php-fig ͕ࡦఆ͍ͯ͠ΔίʔσΟϯάن໿ • ͦΕͧΕͷϑϨʔϜϫʔΫͰͦΕͧΕͷίʔ σΟϯάن໿Λ࡞Βͣʹɺ౷ҰͷίʔσΟϯ άن໿ʹ͠·͠ΐ͏ɻͱ͍͏͓͸ͳ͠

  59. php-fig members "HBWJ %BWJE;ÛMLF !E[VFMLF "NB[PO8FC4FSWJDFT4%, 3ZBO1BSNBO !4LZ[ZY "QBDIFMPHQIQ *WBO)BCVOFL

    !JIBCVOFL "TTFUJDBOE#V[[ ,SJT8BMMTNJUI !LSJTXBMMTNJUI "VSB1SPKFDUBOE4PMBS'SBNFXPSL 1BVM.+POFT !QNKPOFT $BLF1)1 -BSSZ.BTUFST !1IQ/VU $PNQPTFSBOE1BDLBHJTU +PSEJ#PHHJBOP !TFMEBFL %PDUSJOF (VJMIFSNF#MBODP !HVJMIFSNFCMBODP %SVQBM -BSSZ(BSpFME !$SFMM F;1VCMJTI "OESF3PNDLF !BOESFSPN 5:10'MPX ,BSTUFO%BNCFLBMOT !LEBNCFLBMOT +BDLBMPQF -VLBT,BIXF4NJUI !MTNJUI +PPNMB %PO(JMCFSU !EJMCFSUMJGF -BSBWFM 5BZMPS0UXFMM !UBZMPSPUXFMM -JUIJVN /BUF"CFMF !OBUFBCFMF 1&"3 #SFUU#JFCFS !TBMUZCFBHMF QIQ## /JMT"EFSNBOO !OBEFSNBO QIQ%PDVNFOUPS .JLFWBO3JFM !NWSJFM 11* 1BVM%SBHPPOJT !ESHPPOJT 1SPQFM 8JMMJBN%VSBOE !DPVBD 1ZSP$.4 1IJM4UVSHFPO !QIJMTUVSHFPO 4BCSF%"7 &WFSU1PU !FWFSUQ 4VHBS$3. +PIO.FSUJD !KNFSUJD 4ZNGPOZ 'BCJFO1PUFODJFS !GBCQPU 5IFDPNNVOJUZBUMBSHF $BM&WBOT !$BM&WBOT ;FOE'SBNFXPSL 1ÂESBJD#SBEZ !QBESBJDC ;JLVMB ,BSNB%PSESBL ![JLVMBESBL
  60. PSR • PSR-0 • ϑΝΠϧ໊ͱΫϥε໊ͷن໿ • PSR-1 • ίʔσΟϯάن໿ •

    PSR-2 • ίʔσΟϯάελΠϧن໿ • PSR-3 • ϩΨʔͷΠϯλϑΣʔεن໿
  61. None
  62. Sapporo.php • PHP ๺ւಓ with LOCAL • LOCAL PHP෦ •

    sapporo-php.net • 2 ϲ݄ʹҰ౓͘Β͍ษڧձ౳
  63. ຊ೔ͷ·ͱΊ • php5.3 Ҏલͷόʔδϣϯ͸΋͏ݹ͍ • φ΢͍ύοέʔδґଘ؅ཧ͸ Composer • ͦͯ͠ Packagist

    ͰͲΜͲΜެ։ • ίʔσΟϯάن໿͸ PSR Ͱ • ೔ຊޠ༁͸ Infinite loop ͞Μ
  64. Any question ? • ʮྑ͍࣭໰Ͱ͢Ͷʯ͕ग़Δͱ PHP Matsuri Tγ ϟπ͋͛·͢ •

    ྑ͍࣭໰͗͢Δͱ๻͕౴͑ΒΕͳ͍Մೳੑ͕ ͋Γ·͢
  65. いつ終わるか? 今でしょ! ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ Sapporo.php