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

有効な使い方を正しく理解して実装する PHP8.3の最新機能の「ウラ側」 / Understa...

有効な使い方を正しく理解して実装する PHP8.3の最新機能の「ウラ側」 / Understanding and Implementing Effective Usage Correctly The "Uraside" of PHP 8.3's Latest Features

Fusic Tech Live Vol.20 〜PHPer CONNECT〜
https://fusic.connpass.com/event/317123/

shiro seike

July 02, 2024
Tweet

More Decks by shiro seike

Other Decks in Programming

Transcript

  1. ©Fusic Co., Ltd. 2 ਗ਼Ո ࢙࿠ @seike460 AWS Community Builders

    Serverless ݄ؒPHPΧϯϑΝϨϯε2024 - PHPΧϯϑΝϨϯε๺ւಓ2024 ొஃ (LT) - PHPΧϯϑΝϨϯεؔ੢2024 ొஃ (LT) - PHPerKaigi2024 ొஃ (LT) - PHPΧϯϑΝϨϯεখాݪ2024 ొஃ - PHPΧϯϑΝϨϯε߳઒2024 ొஃ - PHPΧϯϑΝϨϯε෱Ԭ2024 ొஃ ࣗݾ঺հ ͸͡Ίʹ גࣜձࣾFusic ϓϦϯγύϧΤϯδχΞ/ΤόϯδΣϦετ
  2. ©Fusic Co., Ltd. 6 PHP8.3ͷϦϦʔεʹ͍ͭͯৼΓฦΔ - PHP 8.3.0 - 2023೥11݄23೔

    - PHP 8.3.1 - 2023೥12݄21೔ - PHP 8.3.2 - 2024೥1݄18೔ - PHP 8.3.3 - 2024೥2݄15೔ - PHP 8.3.4 - 2024೥3݄14೔ - PHP 8.3.6 - 2024೥4݄11೔ - PHP 8.3.7 - 2024೥5݄9೔ - PHP 8.3.8 - 2024೥6݄6೔ ɹɹɹɹɹɹɹɹɹɹɹɹ˞PHP8.3.5͸ReleasePage͔Β࡟আࡁ
  3. ©Fusic Co., Ltd. 7 PHP8.3ͷαϙʔτظݶ - Active Support - 2025೥11݄23೔

    ࠓ೔͔Β520೔ - Security Support - 2026೥11݄23೔ ࠓ೔͔Β885೔
  4. ©Fusic Co., Ltd. 18 PHPΧϯϑΝϨϯε෱Ԭ2024Ͱ৮Εͨࣄ - ػೳͱͯ͠ͷ௥Ճ - Ϋϥεఆ਺ͷܕ෇͚ -

    Ϋϥεఆ਺ͷจࣈྻࢦఆ - Attribute#[\Override]ͷ௥Ճ - ಡΈऔΓઐ༻ϓϩύςΟͷσΟʔϓΫϩʔϯ https://www.php.net/releases/8.3/ja.php
  5. ©Fusic Co., Ltd. 19 ຊ೔Ͱ৮ΕΔࣄ - ແ໊Ϋϥε΋readonly ͱͯ͠ϚʔΫͰ͖Δ - ϚδοΫϝιουͰ࡞ͬͨΫϩʔδϟ

    ໊લ෇͖Ҿ਺Λड͚ೖΕՄೳ - τϨΠτͷϝιουͷfinal ࢦఆ - static ม਺ͷॳظԽʹ೚ҙͷࣜར༻Մ https://www.php.net/manual/ja/migration83.new-features.php
  6. ©Fusic Co., Ltd. 22 ͦ΋ͦ΋ແ໊Ϋϥεͱ͸ʁ ແ໊Ϋϥε ͸໊લΛ࣋ͨͳ͍Ϋϥε Ұ౓͚ͩ࢖༻͢Δ৔߹ʹศར ར఺ -

    Ұ࣌࢖༻͢ΔΦϒδΣΫτΛ͙͢ʹ ࡞੒Ͱ͖ίʔυͷ؆ܿ͞Λอͭ - ಗ໊ؔ਺ͱࣅͨ࢖͍ํ͕Ͱ͖ɺ ؔ਺΍ϝιουͷҾ਺ͱͯ͠౉͢
  7. ©Fusic Co., Ltd. 24 ͦ΋ͦ΋magic methodͱ͸ʁ PHPͰಛఆͷঢ়گԼͰ ࣗಈతʹݺͼग़͞ΕΔϝιου __construct() ɹΠϯελϯεԽ͞ΕΔͱ͖

    __destruct() ɹΠϯελϯε͕ഁغ͞ΕΔͱ͖ __call() ɹଘࡏ͠ͳ͍ϝιου͕ ɹݺͼग़͞Εͨͱ͖
  8. ©Fusic Co., Ltd. 27 Trait Methodͷfinal ࢦఆ use ExampleTrait {

    importantMethod as final; } ͷΑ͏ͳܗͰར༻Մೳʹ PHP8.2Ͱ͸ΤϥʔʹͳΓ·͢
  9. ©Fusic Co., Ltd. 30 static ม਺ͷॳظԽʹ೚ҙͷࣜར༻Մ static ม਺೚ҙͷࣜΛຒΊࠐΈՄೳʹ Ұ౓͚ͩऔಘ͢Δ෦෼ʹࠩ͠ࠐΊΔ ྫ͑͹DBͷCounterͳͲʹ΋ར༻Մೳ

    ※ྫ͸τϥϯβΫγϣϯ͕ແࢹ͞ΕΔ ਅࣅ͠ͳ͍Ͱ͍ͩ͘͞… Ұ౓͔͠ݺ͹Εͳ͍ͷͰ Singletonͷ࣮૷ʹ࢖͑Δ…ʁ
  10. ©Fusic Co., Ltd. 33 ͕ɺ࠷৽ͷ৘ใ͸൓ө͖͠Ε͍ͯͳ͍… magic methodͰ࡞ͬͨ Closure ʹؔͯ͠͸આ໌Έͯ૝૾͕෇͖ͮΒ͘ αϯϓϧίʔυͳͲͳͯ͘

    ͲͷΑ͏ͳ΋ͷ͔গ͠໎ͬͨ Closure ͷઆ໌΍magic methods ·ͰϚχϡΞϧΛಡΜͰݟ·͕ͨ͠ ·ͩ൓ө͞Ε͍ͯ·ͤΜͰͨ͠ ݁ՌChatGPTsΈ͍ͨͳ෦෼΋ ඍົͳ݁Ռʹ
  11. ©Fusic Co., Ltd. 34 ۩ମʹؔͯ͠͸ӳจͰGitHubΛݕࡧ͢Δͷ͕ૣ͍ php / php-srcͷGitHubʹ ૝ఆͷαϯϓϧίʔυͳͲ΋৐͍ͬͯͨ ߏจͳͲ͕ཧղग़དྷͨΓ΋͠·ͨ͠

    ࠓճ࣮͸Ұ൪ݸਓతʹֶͼʹͳͬͨͷ͕ PHPϚχϡΞϧͱ php/php-srcΛ ྆ํಡΉ͜ͱͰ͍ΖΜͳ৘ใΛ ௥͑ΔΑ͏ʹͳΓ·ͨ͠
  12. ©Fusic Co., Ltd. 38 ·ͱΊ PHP8.3͸2026೥·Ͱར༻͠·͢ɻ͔ͬ͠Γ޲͖߹͍·͠ΐ͏ Point 01 PHP 8.3.0

    Release Announcementʹ৐͍ͬͯͳ͍ػೳ΋͋Γ·͢ Point 02 ৘ใΛूΊΔखஈΛཱ֬͢Δ͜ͱͰɺ͞Βʹֶͼ͕޿͕Γ·͢ɻࣗ෼ͨͪͷ৘ใͷ௥͍ํΛݟ͚ͭ·͠ΐ͏ʂ Point 03