Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
自作PHPライブラリをリファクタリングした / Refactoring library
Search
howyi
December 21, 2018
Programming
0
110
自作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.6k
GraphQLを活用するツールやライブラリ / graphql-libraries
howyi
0
98
GraphQLの紹介 / graphql-introduction
howyi
0
71
サーバレスアーキテクチャでSlackBotを作る / serverless-slackbot
howyi
0
74
Amplifyの紹介/amplify-introduction
howyi
0
87
AWS認定を受けた話 / AWS CERTIFIED
howyi
0
85
PhpStormの設定晒す / Customizing PhpStorm
howyi
0
110
ClickUpで始める進捗管理 / ClickUp
howyi
0
500
Other Decks in Programming
See All in Programming
Developing static sites with Ruby
okuramasafumi
0
290
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
730
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
3
720
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
6
310
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
110
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
130
認証・認可の基本を学ぼう後編
kouyuume
0
190
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
330
AIコーディングエージェント(NotebookLM)
kondai24
0
190
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
170
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
18
7.4k
愛される翻訳の秘訣
kishikawakatsumi
3
320
Featured
See All Featured
BBQ
matthewcrist
89
9.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Site-Speed That Sticks
csswizardry
13
1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Unsuck your backbone
ammeep
671
58k
Designing for humans not robots
tammielis
254
26k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
KATA
mclloyd
PRO
32
15k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
730
A better future with KSS
kneath
240
18k
Writing Fast Ruby
sferik
630
62k
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