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
330
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
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
720
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
230
AWS reInvent 2024サービスアップデートデモ / AWS reInvent 2024 Service Update Demo
seike460
PRO
0
28
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
580
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
1.2k
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
370
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
630
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
770
いまあるチームにフィットさせる Serverless そして Platform Engineeringへの挑戦 / Serverless Fits the Team You Have and Platform Engineering
seike460
PRO
2
2.1k
Other Decks in Programming
See All in Programming
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
3
160
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
6
1.3k
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
390
バグを見つけた?それAppleに直してもらおう!
uetyo
0
210
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
230
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
270
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
630
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
8
1.8k
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
200
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
410
テストケースの名前はどうつけるべきか?
orgachem
PRO
1
180
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
260
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
97
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Facilitating Awesome Meetings
lara
50
6.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Agile that works and the tools we love
rasmusluckow
328
21k
The Cost Of JavaScript in 2023
addyosmani
46
7.2k
The Invisible Side of Design
smashingmag
299
50k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Docker and Python
trallard
43
3.2k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠