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
320
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
670
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
180
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
540
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
1.1k
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
360
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
600
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
いまあるチームにフィットさせる Serverless / Serverless fits in with the team you have now.
seike460
PRO
2
190
Other Decks in Programming
See All in Programming
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.1k
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
360
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
890
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
190
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
250
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
300
良いユニットテストを書こう
mototakatsu
11
3.3k
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
510
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1.1k
為你自己學 Python
eddie
0
370
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
360
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
190
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Building Applications with DynamoDB
mza
91
6.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Visualization
eitanlees
146
15k
A Tale of Four Properties
chriscoyier
157
23k
The World Runs on Bad Software
bkeepers
PRO
66
11k
It's Worth the Effort
3n
183
28k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
530
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠