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 のドキュメントを読んで PHP のことをもっと知ろう
Search
Katsuhiro Ogawa
March 01, 2016
Technology
1
3.1k
PHP のドキュメントを読んで PHP のことをもっと知ろう
at PHP BLT #3
Katsuhiro Ogawa
March 01, 2016
Tweet
Share
More Decks by Katsuhiro Ogawa
See All by Katsuhiro Ogawa
新規プロダクト開発に伴う既存マイクロサービスのリアーキテクティングとその後
fivestar
1
130
Goで学ぶSOLID原則
fivestar
0
270
メルカリ CSE チームの 歩みと取り組み / Steps and Tries in the CSE team for Mercari
fivestar
2
870
Go in Corporate Solutions Engineering
fivestar
0
2.4k
いつまでPHP 5.x使ってるの
fivestar
1
1.9k
CrocosSecurityBundleを Symfony3.0に対応した話
fivestar
0
220
PHP BLT だけど HTML5 の コンテンツモデルのお話
fivestar
0
2.3k
THE NEW "PERFECT PHP" WILL BE COMING SOON
fivestar
0
8k
Symfony - フレームワークの先へ
fivestar
2
9.8k
Other Decks in Technology
See All in Technology
20241015 Toranomon Tech Hub#1 Service Catalog使ってみた
hiashisan
0
230
地域DXにおけるGrafana活用事例
wacky
0
390
APIs for AI: Have we failed?
zdne
0
130
太田博三(@usagisan2020)
otanet
0
150
Japan AWS Jr. Championsがお届けする、アウトプットのすすめ
hamijay_cloud
0
210
Nuxt × Vue Router の力を最大限に引き出す機能を紹介
ytr0903
2
330
外部カンファレンスで登壇しよう! 〜「強い」エンジニアへの一歩を踏み出す〜
logica0419
4
140
AIとともに歩んだライブラリアップデートの道のり/ vue-fes-japan-2024-link-and-motivation
lmi
2
2.1k
Demystifying Vite Internals
nozomuikuta
3
760
Azure AI servicesと歯のおはなし/AzureTravelers_Fukuoka2024_baba
nina01
1
110
VPoE Meetup Vol.1 VPoEとして実践してきたことと反省点
coconala_engineer
2
180
Road to Single Activity Uncovered
yurihondo
0
110
Featured
See All Featured
Become a Pro
speakerdeck
PRO
24
4.9k
BBQ
matthewcrist
85
9.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
A Philosophy of Restraint
colly
203
16k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
23k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
A better future with KSS
kneath
237
17k
Code Reviewing Like a Champion
maltzj
519
39k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Transcript
1)1ͷυΩϡϝϯτΛಡΜͰ 1)1ͷ͜ͱΛͬͱΖ͏ খ༤େ!pWFTUS 1 PHP BLT #3
খ༤େ (͓͕Θ͔ͭͻΖ) @fivestr Racing Driver (Amateur) Author of "Perfect PHP"
CTO at Ancar Inc. 2
Έͳ͞Μ1)1ͷ࠷৽ಈνΣοΫͯ͠·͔͢ʁ w 1)1ͰԿ͕৽͘͠ͳ͔ͬͨ w ࠓޙͲͷΑ͏ͳػೳ͕Ճ͞ΕΔ͔ 3
1)1 w εΧϥʔλΠϓώϯτ w ϦλʔϯλΠϓώϯτ w ԋࢉࢠ /VMM߹ମԋࢉࢠ w
ԋࢉࢠ εϖʔεγοϓԋࢉࢠ w ແ໊Ϋϥε 4
1)1&SSPS w 5ISPXBCMF w &SSPS w &YDFQUJPO w ͪͳΈʹ#BTF&YDFQUJPOͰͳ͘ͳΓ·ͨ͠ 5
use Entity\{Article, Author, Comment}; 6
ҠߦυΩϡϝϯτΛಡΈ·͠ΐ͏ w <1)1Y͔Β1)1YͷҠߦ> IUUQQIQOFUNBOVBMKBNJHSBUJPOQIQ w ֤ϝδϟʔϚΠφʔόʔδϣϯ͝ͱʹ ҠߦυΩϡϝϯτ͕͋Γ·͢ w
w υΩϡϝϯτͷτοϓ͔ΒḷΕ·͢ 7
ҠߦυΩϡϝϯτ͍͢͝ w جຊతʹͯ͢ͷมߋ͕·ͱΊΒΕ͍ͯ·͢ w ͔͍͍ͩͨ͠༁͞Ε͍ͯ·͢ w NUBLBHJ͞Μຊʹ͋Γ͕ͱ͏ 8
ࠓޙͷಈ͖Ͳ͏ͬͯݟ͍͚͍͍ͯͷʁ w ҠߦυΩϡϝϯτΛಡΊϦϦʔε͞Εͨ ใΘ͔ΔΑ͏ʹͳΓ·ͨ͠ w ͜Ε͔ΒՃ͞ΕΔػೳͱ͔ Ͳ͏ͬͯΕΑ͍ͷͰ͠ΐ͏͔ 9
1)13'$ w 3'$ͷϖʔδΛݟΔͱࠓޙͷಈ͖Λ νΣοΫͰ͖·͢ w IUUQTXJLJQIQOFUSGD 10
3'$ͷಈ͖ w %SBGU%JTDVTTJPO7PUJOH w "DDFQUFE*NQMFNFOUBUJPO w %FDMJOF w ථͷ݁Ռͷࢍ͕ͳ͍ͱ٫Լ͞ΕΔ 11
*NQMFNFOUFE 12
<>7PJE3FUVSO5ZQF w WPJE Γ͕ͳ͍ ΛϦλʔϯ λΠϓώϯτ͕ఆٛͰ͖ΔΑ͏ʹ 13
function process($data) :void { ... } 14
<>4VQQPSU$MBTT$POTUBOU7JTJCJMJUZ w ΫϥεఆʹΞΫηεम০ࢠΛ ઃఆͰ͖ΔΑ͏ʹ͢Δ 15
class Foo { private const BAR = 'baz'; } 16
"DDFQUFE 1FOEJOH*NQMFNFOUFE 17
"MMPXTQFDJGZJOHLFZTJOMJTU w MJTU Ͱ࿈ྻͷΩʔΛࢦఆͯ͠ ల։Ͱ͖ΔΑ͏ʹ͢Δ 18
list( 'type' => $type, 'value' => $value, ) = $attrs;
19
7PUJOH 20
(FOFSBMJ[FTVQQPSUPGOFHBUJWFTUSJOHP⒎TFUT w จࣈྻͷΦϑηοτࢦఆʹϚΠφεͷΛ ࢦఆͰ͖ΔΑ͏ʹ͢Δ w TVCTUSͳͲؔͰαϙʔτ͞Ε͍ͯͨ w ͍·ͷͱ͜ΖରͰ͍ͯͳ͍ͷͰ௨Γͦ͏ 21
$str = 'abcdef'; var_dump($str[-2]); // => string(1) "e" 22
6OEFS%JTDVTTJPO 23
5SBJUTXJUIJOUFSGBDFT w τϨΠτʹΠϯλʔϑΣΠεΛ ࣮Ͱ͖ΔΑ͏ʹ͢Δ w ͢Β͍͠ w ͥͻ࣮͍͖͍ͯͨͩͨ͠ 24
trait LoggerInjectTrait implements LoggerAwareInterface { protected $logger; /** @Inject */
public function setLogger(LoggerInterface $logger) { $this->logger = $logger; } } 25
%FDMJOF 26
1SPQFSUZ"DDFTTPST4ZOUBY w ΫϥεͷϓϩύςΟͷΞΫηαఆٛ w ΊͬͪΌཉ͔ͬͨ͠ͷʹͳΜͰ 27
$MBTT.FUBEBUB "OOPUBUJPOT w ΞϊςʔγϣϯͷωΠςΟϒαϙʔτ ٫Լ͞Ε͍ͯΔ w %PDίϝϯτͷΞϊςʔγϣϯΛѻ͏ ʮ"OOPUBUJPOTJOEPDCMPDLʯ *OBDUJWFʹͳ͍ͬͯΔ 28
·ͱΊΔͱ 29
1)1υΩϡϝϯτΛಡ͏ w ҠߦΨΠυΛಡΉͱϦϦʔεͷ༰͕ ѲͰ͖·͢ w 3'$ΛಡΉͱࠓޙͷػೳՃͳͲͷಈΛ ݟΔ͜ͱ͕Ͱ͖·͢ 30
͍͞͝ʹ 31
1)1ΤϯδχΞͱ J04ΤϯδχΞͱ "OESPJEΤϯδχΞͱ σβΠφʔͱ ͱ͔͘Ұॹʹಇ͍ͯ͘ΕΔํΛืू͍ͯ͠·͢ʂʂ 32