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
howyi
December 21, 2018
Programming
0
96
自作PHPライブラリをリファクタリングした / Refactoring library
社内勉強会で発表したスライドです。
ライブラリ:
https://github.com/howyi/conv
howyi
December 21, 2018
Tweet
Share
More Decks by howyi
See All by howyi
Go+gRPCで作った次世代店舗の裏側
howyi
1
1.5k
GraphQLを活用するツールやライブラリ / graphql-libraries
howyi
0
82
GraphQLの紹介 / graphql-introduction
howyi
0
57
サーバレスアーキテクチャでSlackBotを作る / serverless-slackbot
howyi
0
62
Amplifyの紹介/amplify-introduction
howyi
0
73
AWS認定を受けた話 / AWS CERTIFIED
howyi
0
82
PhpStormの設定晒す / Customizing PhpStorm
howyi
0
90
ClickUpで始める進捗管理 / ClickUp
howyi
0
480
Other Decks in Programming
See All in Programming
「兵法」から見る質とスピード
ickx
0
260
Perplexity Slack Botを作ってAI活用を進めた話 / AI Engineering Summit プレイベント
n3xem
0
640
ワイがおすすめする新潟の食 / 20250530phpconf-niigata-eve
kasacchiful
0
300
ドメインモデリングにおける抽象の役割、tagless-finalによるDSL構築、そして型安全な最適化
knih
10
1.8k
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
200
社内での開発コミュニティ活動とモジュラーモノリス標準化事例のご紹介/xPalette and Introduction of Modular monolith standardization
m4maruyama
0
120
[初登壇@jAZUG]アプリ開発者が気になるGoogleCloud/Azure+wasm/wasi
asaringo
0
130
コードに語らせよう――自己ドキュメント化が内包する楽しさについて / Let the Code Speak
nrslib
6
1.4k
無関心の谷
kanayannet
0
160
インターフェース設計のコツとツボ
togishima
2
700
Webからモバイルへ Vue.js × Capacitor 活用事例
naokihaba
0
540
Create a website using Spatial Web
akkeylab
0
260
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Side Projects
sachag
454
42k
What's in a price? How to price your products and services
michaelherold
245
12k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
43
2.4k
Become a Pro
speakerdeck
PRO
28
5.4k
Automating Front-end Workflow
addyosmani
1370
200k
Navigating Team Friction
lara
186
15k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Building Adaptive Systems
keathley
43
2.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
14
1.5k
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