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
200
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
28
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
400
技術力を高め合う “開けた”企業間コミュニティの形成 / Formation of an "open" inter-company community to enhance technological capabilities
seike460
PRO
1
77
有効な使い方を正しく理解して実装する PHP8.3の最新機能の「ウラ側」 / Understanding and Implementing Effective Usage Correctly The "Uraside" of PHP 8.3's Latest Features
seike460
PRO
1
120
有効な使い方を正しく理解して実装する PHP8.3の最新機能 / Proper understanding and implementation of effective usage Latest features in PHP 8.3
seike460
PRO
2
330
事例から見るサーバーレスの効果 / 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
87
Other Decks in Programming
See All in Programming
マイグレーションコード自作して File-Based Routing に自動移行!! ~250 ページの歴史的経緯を添えて~
cut0
1
260
Method Swizzlingを行うライブラリにおけるマルチモジュール設計
yoshikma
0
110
null or undefined
susisu
24
6.2k
大公開!iOS開発の悩みトップ5 〜iOSDC Japan 2024〜
ryunakayama
0
190
LangChainの現在とv0.3にむけて
os1ma
4
890
Prolog入門
qnighy
4
1k
Kotlin 2.0 and Beyond
antonarhipov
2
150
Amebaチョイス立ち上げの裏側 ~依存システムとの闘い~
daichi_igarashi
0
230
Swift Concurrencyとレースコンディション
objectiveaudio
1
410
GenU導入でCDKに初挑戦し、悪戦苦闘した話
hideg
0
160
Ruby Parser progress report 2024
yui_knk
2
220
React + TextAliveでカッコいいLyric Applicatioinを作ろう!!
tosuri13
0
400
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
93
13k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
166
48k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
36
1.7k
A designer walks into a library…
pauljervisheath
201
24k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
663
120k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
230
17k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
GitHub's CSS Performance
jonrohan
1029
450k
Build your cross-platform service in a week with App Engine
jlugia
228
18k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
27
7.4k
The Cult of Friendly URLs
andyhume
76
6k
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠