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
パーフェクトPHPのススメ
Search
Yumihiki
October 30, 2019
Programming
1
1k
パーフェクトPHPのススメ
Web×PHP TechCafe 10月 @ RAKUS のLT資料です。
Yumihiki
October 30, 2019
Tweet
Share
More Decks by Yumihiki
See All by Yumihiki
pathlibのススメ
nibuno
0
43
ノリと勢いで勉強会を共同主催しはじめた話
nibuno
1
330
LTってなんなん?
nibuno
0
120
【初心者向け】ググらずに!? ターミナル上で Pythonオブジェクトを調べよう
nibuno
0
470
勇気出してアウトプットしたらコメントをもらえて自分の理解が深まった良い話🤩
nibuno
0
170
テスト駆動開発のススメ
nibuno
2
21k
目標を決めるにあたって 新年の抱負 超LT会- vol.2
nibuno
0
360
Other Decks in Programming
See All in Programming
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
940
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
140
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
890
イベント駆動で成長して委員会
happymana
1
330
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
Jakarta EE meets AI
ivargrimstad
0
580
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
140
みんなでプロポーザルを書いてみた
yuriko1211
0
270
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
CSC509 Lecture 13
javiergs
PRO
0
110
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
GitHub's CSS Performance
jonrohan
1030
460k
Designing the Hi-DPI Web
ddemaree
280
34k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Optimizing for Happiness
mojombo
376
70k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Building Adaptive Systems
keathley
38
2.3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Transcript
ύʔϑΣΫτ1)1ͷεεϝ :VNJIJLJ 8FCº1)15FDI$BGF݄ˏ3",64
ࣗݾհ :VNJIJLJʢΏΈͻ͖ʣ 1)1FSͰ͢ υϥΰϯΫΤετΥʔΫͷ Γ͗͢ͰΛ௧Ί·ͨ͠ ٷಓՈٷҾ͖ɹ͕༝དྷͰ͢
ύʔϑΣΫτ1)1͍͍ͧ
ηΫγʔͳ1)1FSʹ ͳΔͨΊʹඞಡͷҰ ύʔϑΣΫτ
ύʔϑΣΫτ1)1ͱ Ͱݴޠ༷͔Β࠷৽ͷٕज़·ͰΛཏͨ͠༰ɻ ཏతʹղઆ͞Ε͍ͯΔ͚ͩͰͳ͘ɼ֤ٕज़ʹؔͯ͠جຊ͔Β͔ͬ͠Γղઆ͠ɼ ϑϨʔϜϫʔΫͳͲΛར༻ͨ͠8FCΞϓϦέʔγϣϯ։ൃͷղઆͳͲɼ ෦ॲཧ͕ཪͰԿΛ͍ͯ͠Δͷ͔Λ۷ΓԼ͛ͯղઆͯ͋͠ΔͨΊɼ 1)1Λମܥతʹֶͼ͍ͨํͪΖΜɼ ΑΓਂ͍ࣝΛಘ͍ͨதʙ্ڃऀʹ͓קΊͷҰͰ͋Δɻ IUUQTHJIZPKQCPPL͜ͷຊͷ֓ཁΑΓ
ϑϨʔϜϫʔΫΛ࡞ͬͯ 8FCΞϓϦέʔγϣϯΛ ։ൃ͠·͢
࣮ࡍʹֶशͯ͠Έͯ
#FGPSF ͦͦΦϒδΣΫτࢦͬͯԿʁɹඒຯ͍͠ͷʁ UIJT QVCMJD JOUFSGBDF TFMG ʜ֮͑Δ୯ޠଟ͘ͳ͍ʁ ϑϨʔϜϫʔΫதͰԿͯ͠ΔΜ͔ ਖ਼Θ͔Βͳ͍ɾɾɾ
"GUFS ΦϒδΣΫτࢦͱ ϑϨʔϜϫʔΫͷΈ શʹཧղͨ͠
࣮ࡍʹϑϨʔϜϫʔΫΛར༻ͯ͠ ࡞͢Δ8FCΞϓϦέʔγϣϯ ͜Μͳײ͡Ͱ͢ʢࠓ͔Βө͠·͢ʣ
ϑϨʔϜϫʔΫʹ͍ͭͯ গ͠ղઆΛߦ͍͖ͬͯ·͢
ύʔϑΣΫτ̥̝̥Ͱ࡞Δ ϑϨʔϜϫʔΫʹ͍ͭͯ
ϑϨʔϜϫʔΫͷཁ݅ • MVCϞσϧʹΑΔׂͷ • σʔλϕʔεͷଓཧ • ϩάΠϯঢ়ଶͷཧ • URLͱཧతͳσΟϨΫτϦߏͱΛΓ͢ϧʔςΟϯάػೳ •
CSRFରࡦ
ϑϨʔϜϫʔΫͷ ߏɾॲཧͷྲྀΕ
3FRVFTU (&51045 ύϥϝʔλɺ63- ͷཧ "QQMJDBUJPO 3PVUFS 63-Λड͚औΓ ݺͼग़͢ ίϯτϩʔϥΛࢦఆ $POUSPMMFS
ϞσϧϏϡʔͷ ੍ޚΛߦ͏ ΞΫγϣϯΛఆٛ 3FTQPOTF ϦΫΤετʹର͠ ࠷ऴతʹϢʔβ ฦ͢ใΛཧ %C.BOBHFS σʔλϕʔεͷଓ ใ%C3FQPTJUPSZ ͷཧ %C3FQPTJUPSZ ΞΫηεΛ͏ॲཧΛ ཧɻϞσϧʹ૬ 4FTTJPO ηογϣϯ Λཧ͢Δ 7JFX දࣔΛ੍ޚ͢Δɻ ϑΝΠϧͷಡΈࠐΈ ड͚͠Λߦ͏ ύʔϑΣΫτ1)1 ϖʔδΑΓ ͜ͷҰ࿈ͷྲྀΕΛ ੍ޚ͢ΔΫϥε ࠷ॳ͔͜͜Βʂ ࠷ޙʹใΛग़ྗʂ
͜͏͍͏෦తͳ ॲཧ͕͋Δͷ͔ͱ ษڧʹͳͬͨ͜ͱ
৭ʑ͋Γ·͢
ྫ͑
ΫϥεͱΦʔτϩʔυ
ΫϥεͱΦʔτϩʔυ ΦʔτϩʔυΛઃఆ͢Δ͜ͱͰΫϥεΛݺͼग़ͨ͠ࡍʹ ͦͷΫϥε͕PHP্ʹಡΈࠐ·Ε͍ͯͳ͍߹ɺ ࣗಈతʹϑΝΠϧͷಡΈࠐΈΛߦ͏͜ͱ͕Ͱ͖ΔΑ͏ʹͳΔɻ ຖճಡΈࠐΈॲཧΛॻ͔ͳͯ͘ྑ͍
Ͳ͏͍ͬͯΔͷʁ
ClassLoader.phpͱ bootstrap.php
ClassLoader.php
ClassLoader.php spl_autoload_register()ϝιουͰ ઃఆͨ͠ίʔϧόοΫؔΛΦʔτϩʔυ࣌ʹݺͼग़ͤΔ
ClassLoader.php σΟϨΫτϦͷొΛߦ͏
ClassLoader.php Φʔτϩʔυ࣌ʹPHP͔Βࣗಈతʹݺͼग़͞Ε ΫϥεϑΝΠϧͷಡΈࠐΈΛߦ͏
ClassLoader.php $dirsϓϩύςΟʹઃఆ͞ΕͨσΟϨΫτϦ͔Β ʮΫϥε໊.phpʯΛ୳͠ݟ͔ͭͬͨ߹ʹrequireͰಡΈ͜Ή
bootstrap.php ClassLoaderΛੜ͠ɺcoreɺmodelσΟϨΫτϦΛ ΦʔτϩʔυͷରσΟϨΫτϦʹઃఆ͠ɺ register()ϝιουͰΦʔτϩʔυʹొ
bootstrap.php ͦͯ͠ɺbootstrap.phpΛಡΈࠐΉͱ Φʔτϩʔυ͕ઃఆ͞Ε·͢
͜ͷΑ͏ͳॲཧͰ ΦʔτϩʔυΛ࣮ ͍ͯ͠·ͨ͠ ศརͰ͢Ͷ
͜͏͍͏෦తͳ ॲཧ͕͋Δͷ͔ͱ ษڧʹͳͬͨ͜ͱ Part2
࣌ؒͷ߹্ࡉ͔͘ ͤͦ͏ʹ͋Γ·ͤΜʜ
গ͠ૣޱͰ ͱͯͬ͘͟Γͱ
ApplicationΫϥεͷ࣮ ίϯτϩʔϥͷݺͼग़͠ ϩάΠϯ੍ޚͳͲ
ଟͷ෦తͳॲཧΛ هड़͠ɺಈ͖ΛΔ ͜ͱ͕Ͱ͖·͢
ࠓͨ͠༰ ύʔϑΣΫτPHPͷ ΄ΜͷҰ෦͚ͩͰ͢
ͥͻҰ ύʔϑΣΫτPHPΛ ಡΜͰΈ͍ͯͩ͘͞
FIN. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠