$30 off During Our Annual Pro Sale. View Details »
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
230
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 Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
270
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
980
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
330
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
560
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
720
いまあるチームにフィットさせる Serverless そして Platform Engineeringへの挑戦 / Serverless Fits the Team You Have and Platform Engineering
seike460
PRO
2
1.9k
いまあるチームにフィットさせる Serverless / Serverless fits in with the team you have now.
seike460
PRO
2
180
地方こそサーバーレス! チームにフィットさせるサーバーレス / Rural areas are serverless! Serverless to Fit Your Team
seike460
PRO
1
110
AWS X-Rayを利用したサーバーレスのパフォーマンス分析 / Serverless performance analysis using AWS X-Ray
seike460
PRO
2
170
Other Decks in Programming
See All in Programming
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
3
1.3k
大規模サイトリビルドの現場から:成功と失敗のリアルな教訓 / Site Rebuild,Real Lessons Learned from Successes and Failures_JJUG Fall 2024
techtekt
0
160
Djangoの開発環境で工夫したこと - pre-commit / DevContainer
hiroki_yod
1
440
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
170
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
9
1.9k
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
150
Missing parts when designing and implementing Android UI
ericksli
0
340
Cursorでアプリケーションの追加開発や保守をどこまでできるか試したら得るものが多かった話
drumnistnakano
0
150
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
6
2k
距離関数を極める! / SESSIONS 2024
gam0022
0
330
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
150
CSC509 Lecture 13
javiergs
PRO
0
110
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
Designing the Hi-DPI Web
ddemaree
280
34k
Designing for humans not robots
tammielis
250
25k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Six Lessons from altMBA
skipperchong
27
3.5k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
140
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Embracing the Ebb and Flow
colly
84
4.5k
Code Review Best Practice
trishagee
64
17k
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠