Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHP8.3の機能を振り返る / Review of PHP 8.3 features
Search
shiro seike
PRO
April 13, 2024
Programming
1
190
PHP8.3の機能を振り返る / Review of PHP 8.3 features
PHPカンファレンス小田原2024
https://phpcon-odawara.jp/2024
shiro seike
PRO
April 13, 2024
Tweet
Share
More Decks by shiro seike
See All by shiro seike
AWS X-Rayを利用したサーバーレスのパフォーマンス分析 / Serverless performance analysis using AWS X-Ray
seike460
PRO
2
24
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
390
技術力を高め合う “開けた”企業間コミュニティの形成 / Formation of an "open" inter-company community to enhance technological capabilities
seike460
PRO
1
75
有効な使い方を正しく理解して実装する PHP8.3の最新機能の「ウラ側」 / Understanding and Implementing Effective Usage Correctly The "Uraside" of PHP 8.3's Latest Features
seike460
PRO
1
110
有効な使い方を正しく理解して実装する PHP8.3の最新機能 / Proper understanding and implementation of effective usage Latest features in PHP 8.3
seike460
PRO
2
320
事例から見るサーバーレスの効果 / Serverless Effectiveness as Seen in Case Studies
seike460
PRO
1
110
Secure Serverless Architecture
seike460
PRO
2
610
地方こそサーバーレス、その意義に迫るサーバーレスPHP / Serverless PHP: The Rural Areas, and Why Serverless PHP Matters
seike460
PRO
2
210
サーバーレスらしさを意識した AWSにおける開発手法 / Development methodologies in AWS that are serverless-like
seike460
PRO
1
85
Other Decks in Programming
See All in Programming
私の考える初学者がBlazorできるまでの学習方法
tomokusaba
1
250
私のEbitengineの第一歩
qt_luigi
0
420
dRuby 入門者によるあなたの身近にあるdRuby 入門
makicamel
4
340
The Sequel to a Dream of Ruby Parser's Grammar
ydah
1
190
Swiftで高速フーリエ変換してオーディオビジュアライザーを作る / iOSDC Japan 2024 Day1 Track D
kyome22
2
480
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
220
Rechartsで楽にゴリゴリにカスタマイズする!
10tera
1
120
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
370
ゲームボーイアドバンスでSwiftを動かそう
k_koheyi
0
520
LangChainでWebサイトの内容取得やGitHubソースコード取得
shukob
0
130
2024 컴포즈 정원사
jisungbin
0
150
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
4
710
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
228
18k
GitHub's CSS Performance
jonrohan
1029
450k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
28
2.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
34
1.9k
Statistics for Hackers
jakevdp
793
220k
Testing 201, or: Great Expectations
jmmastey
35
6.9k
Designing on Purpose - Digital PM Summit 2013
jponch
113
6.8k
In The Pink: A Labor of Love
frogandcode
139
22k
Designing for Performance
lara
604
68k
For a Future-Friendly Web
brad_frost
173
9.3k
Building Your Own Lightsaber
phodgson
101
6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
22
3.9k
Transcript
©Fusic Co., Ltd. 1 PHP8.3ͷػೳΛৼΓฦΔ 2024.04.13 ਗ਼Ո࢙ @seike460 PHPΧϯϑΝϨϯεখాݪ2024
©Fusic Co., Ltd. 2 ਗ਼Ո ࢙ @seike460 AWS Community Builder
Serverless PHPΧϯϑΝϨϯεԬ2023 ࣮ߦҕһ - ίϛϡχςΟ - Fukuoka.php - Fukuoka.go - JAWS-UG Fukuoka - Serverless Meetup Fukuoka - Cloudflare Meetup Fukuoka - JP_Stripes Fukuoka ࣗݾհ ͡Ίʹ גࣜձࣾFusic ϓϦϯγύϧΤϯδχΞ/ΤόϯδΣϦετ
©Fusic Co., Ltd. 3 CONTENTS ࣍ 1. PHP8.3ͷϦϦʔεʹ͍ͭͯৼΓฦΔ 2. ৽ػೳͷϦετΞοϓ
3. ֤ػೳͷઆ໌ͱར༻ྫ 4. ύϑΥʔϚϯεൺֱ 5. ·ͱΊ
©Fusic Co., Ltd. 4 PHP8.3ͷϦϦʔεʹ͍ͭͯৼΓฦΔ 1
©Fusic Co., Ltd. 5 PHP8.3ͷϦϦʔεʹ͍ͭͯৼΓฦΔ - PHP 8.3.0 - 202311݄23
- PHP 8.3.1 - 202312݄21 - PHP 8.3.2 - 20241݄18 - PHP 8.3.3 - 20242݄15 - PHP 8.3.4 - 20243݄14 - PHP 8.3.6ɹɹɹɹ˞PHP8.3.5ReleasePage͔Βফ͍͑ͯͨ - 20244݄11ʢNewʂʣ
©Fusic Co., Ltd. 6 PHP8.3ͷαϙʔτظݶ - Active Support - 202511݄23
ࠓ͔Β590 - Security Support - 202611݄23 ࠓ͔Β955 ͭ·ΓPHPΧϯϑΝϨϯεখాݪ2024 ͔Β590ɺ955ͱ͓͍֮͑ͯͯ ࢥ͍ग़ͤΔΑ͏ʹ͓͖ͯ͠·͠ΐ͏
©Fusic Co., Ltd. 7 ৽ػೳͷϦετΞοϓ 2
©Fusic Co., Ltd. 8 ৽ػೳͷϦετΞοϓ - ػೳͱͯ͠ͷՃ - Ϋϥεఆͷܕ͚ -
Ϋϥεఆͷจࣈྻࢦఆ - Attribute#[\Override]ͷՃ - ಡΈऔΓઐ༻ϓϩύςΟͷσΟʔϓΫϩʔϯ - ίϚϯυϥΠϯLinterͷෳϑΝΠϧࢦఆʢࠓճׂѪʣ - ؔɺϝιουͷՃ - json_validate - Randomizer::getBytesFromString() - Randomizer::getFloat() - Randomizer::nextFloat() https://www.php.net/releases/8.3/ja.php
©Fusic Co., Ltd. 9 ֤ػೳͷઆ໌ͱར༻ྫ 3
©Fusic Co., Ltd. 10 Ϋϥεఆͷܕ͚ interfaceͰఆٛ͞Εͨఆ ʮTESTʯ͕จࣈྻͱͯ͠ઃఆ ࣮͢ΔΫϥεFooͰྻʹɺ ͞ΒʹBarͰnullʹมߋ͞Ε͍ͯ·͢ɻ interfaceͷఆ͕ࢠΫϥεͰ
ܕΛࣗ༝ʹมߋͰ͖ΔͨΊɺ ༧ظͤ͵όάͷݪҼͱͳΔՄೳੑ
©Fusic Co., Ltd. 11 Ϋϥεఆͷܕ͚ - ࠾༻͞ΕͨProposal ྻڍܕɺtraitɺinterfaceɺclassؒͰ ܕ͖ͷఆΛڞ༗͠ɺ Ұ؏ੑͱܕ҆શੑΛอ࣋
ఆͷ࠶ఆٛΛڐͭͭ͠ɺ ܕΛอ࣋͢Δ͜ͱͰɺ ༧ଌՄೳͰ҆શͳίʔυϕʔεΛ࣮ݱ
©Fusic Co., Ltd. 12 Ϋϥεఆͷจࣈྻࢦఆ ΫϥεఆΛಈతʹར༻͢Δͱ ߏจΤϥʔʹͳΔ มʹԠͨ͡ɺఆΛग़ྗ͍ͨ͠ έʔεԟʑʹͯ͋͠ΔͨΊ constantؔΛ͏ͳͲ
ඇৗʹࡶʹͳͬͯ͠·͍ͬͯͨ
©Fusic Co., Ltd. 13 Ϋϥεఆͷจࣈྻࢦఆ - มϓϩύςΟಈతʹࢦఆՄೳ ࠨͷ༷ͳέʔεΛར༻͢Δ͜ͱͰ ίʔυͷදݱྗ্͕͕͍ͬͯͨ ࠨͷίʔυPHP8.2Ͱ࣮ߦՄೳ
- มͷಈతࢀর - ΦϒδΣΫτϓϩύςΟͷಈతࢀর - ੩తϓϩύςΟͷಈతࢀর
©Fusic Co., Ltd. 14 Ϋϥεఆͷจࣈྻࢦఆ ͪΖΜϝιουʹରԠ͍ͯͨ͠ ҰํͰఆʹରԠ͍ͯ͠ͳ͔ͬͨ ࠨͷ༷ͳίʔυ ͨΓલʹॻ͍ͯ͠·͍ͦ͏͕ͩ ͜Ε͕NGͩͬͨ
©Fusic Co., Ltd. 15 Ϋϥεఆͷจࣈྻࢦఆ - خ͍͠ར༻έʔε Enum ಛʹEnumΛར༻͢Δέʔε͕خ͍͠ ࣍ͷΑ͏ʹ࣮͢Δ͜ͱग़དྷΔͷͰ
EnumΛඇৗʹར༻͘͢͠ͳΓ·͢ (͜Εͬͱૣ͘ཉ͔ͬͨ͠ͳ͊…) ͜ͷ࣮ʹΑΓདྷʹͳΔͱࣗಈతʹ PHPConference Odawara 2025ʹͳΓ ͋ͱinterfaceΛ࣮͢Δͱ ։࠵ՄೳʹͳΓ·͢
©Fusic Co., Ltd. 16 Attribute#[\Override]ͷՃ ϝιου໊ͷλΠϓϛεͳͲʹΑΓ ҙਤͨ͠ΦʔόʔϥΠυ͕ࣦഊ͠ɺ ҙਤ͠ͳ͍ಈ࡞ͱͳΔ͜ͱ͕͋Δ ࠨͷίʔυͷ߹ɺPHPUnitͷ setUp͕setUppʹͳ͍ͬͯΔͨΊɺ
myProp্͕ॻ͖͞Εͳ͍
©Fusic Co., Ltd. 17 Attribute#[\Override]ͷՃ ϝιου໊ͷλΠϓϛεͳͲʹΑΓ ҙਤͨ͠ΦʔόʔϥΠυ͕ࣦഊ͠ɺ ҙਤ͠ͳ͍ಈ࡞ͱͳΔ͜ͱ͕͋Δ ࠨͷίʔυͷ߹ɺPHPUnitͷ setUp͕setUppʹͳ͍ͬͯΔͨΊɺ
myProp্͕ॻ͖͞Εͳ͍ ݁Ռɺཧ༝͕Θ͔ΒͣҰੜΉ͜ͱʹ
©Fusic Co., Ltd. 18 Attribute#[\Override]ͷՃ - ͛ΔBadέʔε #[\Override]ͱ͍͏Attribute͕Ճ Classinterfaceʹಉ͡Method͕ ఆٛ͞Ε͍ͯͳ͍߹Τϥʔ͕ൃੜ
ҾΓ͕ؒҧ͍ͬͯΔ߹ ݩͷϝιου͕มߋ͞Εͨ߹༗ޮ Fatal error: Tests\Unit\ExampleTest::setUpp() has #[\Override] attribute, but no matching parent method exists
©Fusic Co., Ltd. 19 ಡΈऔΓઐ༻ϓϩύςΟͷσΟʔϓΫϩʔϯ readonlyෆมੑΛอͭͨΊʹ ඇৗʹ༗༻ͳػೳ ҰํΦϒδΣΫτͷΫϩʔϯ࡞ͷࡍ ৽͍͠ڥཁ݅ʹ߹Θͤͯ ෦ঢ়ଶΛมߋ͍ͨ͠ࣄ͕͋Δ
ࠨͷ߹ɺDateTimeΛ Clone࣌ͷͷʹมߋ͍ͨ࣌͠ͷྫ
©Fusic Co., Ltd. 20 json_validate json_validate() ͕ؔՃ JSONϑΥʔϚοτΛޮతʹݕূ json_decode()Λ༻ͨ͠ݕূͰɺ ෆਖ਼ͳJSONσʔλͰ
ΦϒδΣΫτྻΛੜ͠ɺ ແବͳϝϞϦͱCPUΛফඅ͍ͯͨ͠
©Fusic Co., Ltd. 21 Random\Randomizer::getBytesFromString Random֦ுϞδϡʔϧʹɺ ࢦఆͨ͠จࣈྻ͔ΒϥϯμϜͳจࣈྻ Λੜ͢ΔgetBytesFromString͕Ճ ҉߸తʹ҆શͳϥϯμϜจࣈྻ͕ ؆୯ʹੜՄೳʹ
©Fusic Co., Ltd. 22 Random\Randomizer::getFloatɺnextFloat ϥϯμϜුಈখΛੜ͢Δ getFloatՃ nextFloatଘࡏͯ͠ɺ ͜ͷ߹0Ҏ্1ະຬͷුಈখΛ ੜ͢ΔࣄʹͳΓɺࠨͷίʔυͱಉ
©Fusic Co., Ltd. 23 ͦͷଞͷՃؔ͋Γ·͢ ϦϦʔεαΠτChangeLogΛνΣοΫ͠·͠ΐ͏ʂ
©Fusic Co., Ltd. 24 ύϑΥʔϚϯεͷൺֱ 4
©Fusic Co., Ltd. 25 ύϑΥʔϚϯεͷൺֱ ϚΠφʔΞοϓσʔτͳͷͰɺ ڪΒ͘LaravelͳͲͰͷมԽ ݟ͑ͮΒ͍ͱߟ͑·ͨ͠ ͳͷͰCPUBoundͳฏํࠜͷܭࢉΛ ऀͷझຯͰFiberΛ͍
50ճߦ͍·ͨ͠ɻ ※Fiberͬͯ·͕͢ɺCPU BlockingͰ ಉظతͳॲཧͱͳ͍ͬͯ·͢ 50ճLoopͯ͠Δͱࢥ͍ͬͯͩ͘͞ɻ
©Fusic Co., Ltd. 26 ύϑΥʔϚϯεͷൺֱڥ MacBook Pro (2021) asdfͰBuildͨ͠ޙͷphp php.iniͷௐͳ͠
php 8.3.4 php 8.2.17
©Fusic Co., Ltd. 27 ύϑΥʔϚϯεͷൺֱ - ։࢝࣌ؒΛܭଌ - 50ͷFiberΛ༻ҙ͢Δ -
ฏํࠜΛ100000000ճ࣮ߦΛࠐΉ - ऴྃ࣌ؒΛܭଌ
©Fusic Co., Ltd. 28 ύϑΥʔϚϯεͷൺֱ - FiberͷॲཧΛ։࢝ - FiberͷॲཧΛͭ -
ूܭͯ͠૯ܭ࣌ؒΛग़ྗ
©Fusic Co., Ltd. 29 ύϑΥʔϚϯεͷൺֱ PHP8.2.17 PHP8.2.17ɿ10.37ʙ10.39ඵ
©Fusic Co., Ltd. 30 ύϑΥʔϚϯεͷൺֱ PHP8.3.4 PHP8.3.4ɿ10.35ʙ10.37ඵ -> ͪΐͬͱ͚ͩૣ͘ͳ͍ͬͯΔʂ(ͪΐͬͬͱ͚ͩ)
©Fusic Co., Ltd. 31 PHP8.3 ಛʹܕAttributeΛར༻ͯ͠कΕΔͱ͍͏ࢥ͕ڧ͘ײ͡ΒΕͨ PHPݎ࿚ͳϓϩάϥϜΛॻ͘͜ͱ͕ग़དྷΔ४උ͕ग़དྷ͍ͯΔ ঢ়گʹԠͯ͡ݻ͘ॻ͖ɺૣ͞ΛٻΊΔ࣌ॊೈʹهड़ΛબՄೳ
©Fusic Co., Ltd. 32 ·ͱΊ 5
©Fusic Co., Ltd. 33 ·ͱΊ PHP8.3PHPΧϯϑΝϨϯεখాݪ2024͔Β955ͷ͖߹͍Ͱ͢ɻ͔ͬ͠Γ͖߹͍·͠ΐ͏ Point 01 ܕAttributeͰίʔυकΔͱ͍͏උ͕ਐΜͰ͓Γɺࣗͨͪʹͯඋ͢ΔࣄΛબͰ͖Δɻ Point
02 ࠓճՃ͞ΕͨؔҎ֎ͷͷ͋Γ·͢ʂͥͻChangeLogΛͬͯΈ·͠ΐ͏ʂ Point 03 एׯPHP8.3ͷํ͕ૣ͘ͳ͍ͬͯΔࣄ͕ݟ͑ͨɺͰΞοϓσʔτͷతʹ͢Δ΄ͲͰ͋Γ·ͤΜɻ Point 04
©Fusic Co., Ltd. 34 Thank You We are Hiring! https://recruit.fusic.co.jp/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠