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ライブラリをリファクタリングした / Refactoring library
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
howyi
December 21, 2018
Programming
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
自作PHPライブラリをリファクタリングした / Refactoring library
社内勉強会で発表したスライドです。
ライブラリ:
https://github.com/howyi/conv
howyi
December 21, 2018
More Decks by howyi
See All by howyi
Go+gRPCで作った次世代店舗の裏側
howyi
1
1.7k
GraphQLを活用するツールやライブラリ / graphql-libraries
howyi
0
110
GraphQLの紹介 / graphql-introduction
howyi
0
90
サーバレスアーキテクチャでSlackBotを作る / serverless-slackbot
howyi
0
89
Amplifyの紹介/amplify-introduction
howyi
0
110
AWS認定を受けた話 / AWS CERTIFIED
howyi
0
93
PhpStormの設定晒す / Customizing PhpStorm
howyi
0
120
ClickUpで始める進捗管理 / ClickUp
howyi
0
530
Other Decks in Programming
See All in Programming
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
360
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
250
テーブルをDELETEした
yuzneri
0
140
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
550
今さら聞けない .NET CLI
htkym
0
190
その節約、円になってますか?
isamumumu
1
720
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
180
Android CLI
fornewid
0
220
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
170
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
220
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
1
1.6k
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
380
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
470
A better future with KSS
kneath
240
18k
Agile that works and the tools we love
rasmusluckow
331
22k
Making Projects Easy
brettharned
120
6.7k
How to train your dragon (web standard)
notwaldorf
97
6.7k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
230
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Rails Girls Zürich Keynote
gr2m
96
14k
Thoughts on Productivity
jonyablonski
76
5.3k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
200
Darren the Foodie - Storyboard
khoart
PRO
3
3.6k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
440
Transcript
ࣗ࡞1)1ϥΠϒϥϦΛϦϑΝΫλϦϯάͨ͠ IPXZJ
ԿͷϥΠϒϥϦΛϦϑΝΫλϦϯά͔ͨ͠ https://github.com/howyi/conv ϚΠάϨʔγϣϯΫΤϦࣗಈੜϥΠϒϥϦ
ԿނϦϑΝΫλ͔ͨ͠ • MySQL5.7ʹରԠ͢Δ͜ͱʹͳͬͨ • MySQL5.6લఏͷΫΤϦੜͩͬͨͨΊɺ5.7ݻ༗ػೳ͕ೖΕΒΕͳ͔ͬͨ • मਖ਼͠Α͏ͱࢥͬͨΒࠜຊ͔Β͞ͳ͍ͱ͍͚ͳ͔ͬͨ ͍ͭͰ͔ͩΒ৭ʑͦ͏
ͬͨ͜ͱ
namespaceͷมߋ • ϕϯμ໊ΛؚΊΔΑ͏ʹͨ͠ Conv/Hoge -> Howyi/Conv/Hoge • composer.jsonͰͷΦʔτϩʔμن͕PSR-0ͩͬͨͷͰɺPSR-4ʹͨ͠
phpcsͷಋೖ • PSR12 • దʹॻ͖͗ͯͨ͢ͷͰमਖ਼͕େมͩͬͨ
makefileΛফͨ͠ composer scriptʹมߋʢ͔ͤͬ͘composerଆʹػೳ͕͋ΔͷͰʣ test: @vendor/bin/phpunit stan: @vendor/bin/phpstan analyse -l 7
-c phpstan.neon src "scripts": { "test": "phpunit", "stan": "phpstan analyse -l 7 src", } Makefile $ make test $ make stan composer.json $ composer test $ composer stan
ςετ༻SQLΛผϦϙδτϦʹΓग़͠ • ৭ʑͳύλʔϯͷSQLΛ༻ҙ͢Δඞཁ͕͋ΔͨΊɺςετ༻SQL͕ଟ͍ • composer require ~ Ͱ͜ͷςετ༻SQL·ͰΞϓϦʹΈࠐ·ΕΔͷͳΜͱͳ͘ؾ࣋ͪѱ͍ • packagistʹ্͛ͣɺcomposer.jsonͰผϦϙδτϦΛࢦఆ͠ɺrequire-dev͍ͯ͠Δ
"repositories": [ { "type": "vcs", "url": "https://github.com/howyi/conv-test-suite.git", "no-api": true } ],
ෳόʔδϣϯDBʹରԠͰ͖ΔΑ͏ߏͷมߋ ۩ମతʹ Structure͕ʮσʔλϕʔεͷදݱʯʮΫΤϦൃߦʯ ͷ2ͭͷΛ͍࣋ͬͯͨͷͰ ɺ ʮΫΤϦൃߦʯΛDriverΫϥεʢ৽نʣͷʹมߋͨ͠ DriverΫϥεDBͷόʔδϣϯʹΑͬͯΓସ͑ΒΕΔ
ෳόʔδϣϯDBʹରԠͨ͠ςετڥ • docker-composeͰରԠόʔδϣϯͷ ίϯςφΛཱͯΔ • phpunitͰɺෳDBʹରͯ͠ಉ͡ςε τΛ࣮ߦͰ͖ΔΑ͏ʹ • docker-compose upͰDBߏங+ςετ
࣮ߦ·Ͱߦ͏
ෳόʔδϣϯDBʹରԠͨ͠CIڥ ରԠલͱେ͖ͳҧ͍ͳ͘ɺมΘͬͨ෦ ʮTravisCI͕docker-composeͰςετΛ࣮ߦ͢Δ༻ʹͳͬͨʯͷΈ TravisCIͰಈ͘ίϯςφ෦͔ΒcoverallsʹΧόϨοδΛ͍͛ͯΔ
͓ΘΓ Photo by 1.Shane Stagner on Unsplash 12.Viviana Rishe on
Unsplash