Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PsySHを使った効率的なデバッグ方法について / How debug efficientl...
Search
Futoshi Endo
March 25, 2023
Programming
2.7k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PsySHを使った効率的なデバッグ方法について / How debug efficiently using PsySH
Futoshi Endo
March 25, 2023
Transcript
33 slides
© 2012-2023 BASE, Inc. 2023/03/25 PHPerKaigi2023 LT PsySHを使った効率的なデバッグ方法について
© 2012-2023 BASE, Inc. 2 氏名:Futoshi Endo 所属:BASE株式会社 業務:バックエンド エンジニア
趣味:料理、音楽鑑賞、ゲーム PHP歴は6年。 好きなPHPの関数は array_map です。 • Endo Tech Blog • https://scrapbox.io/fendo181/ Fendo181 自己紹介
© 2012-2023 BASE, Inc. 今日の本題
© 2012-2023 BASE, Inc. 今日の本題 4 var_dump したけど ほしかった情報が 出てなかった...。
別の箇所でもう一度 var_dumpさせよう Xdebugの リモートデバッグを試そう としたけど、思った以上に 設定に時間がかかるなぁ... こんな経験ありませんか?
© 2012-2023 BASE, Inc. 今日の本題 5 debugの為にdebugしている...ってコト!?
© 2012-2023 BASE, Inc. 今日の本題 6 PsySHの良さを伝えにきました
© 2012-2023 BASE, Inc. アジェンダ
© 2012-2023 BASE, Inc. アジェンダ 8 • PsySHの紹介 • 基本的な使い方について
• おすすめのデバッグ方法 • まとめ • (参考文献の紹介)
© 2012-2023 BASE, Inc. PsySHの紹介
© 2012-2023 BASE, Inc. PsySHの紹介 10 • PsySH is a
runtime developer console, interactive debugger and REPL for PHP. ◦ REPL(Read-Eval-Print Loop) ◦ 2012年の6月からプロジェクトが開始されていた ▪ http://justinhileman.info/projects/ • PsySHはPHPの対話型シェル(REPL)であり、コードを実行しながら対話的にデバッ グや開発を行うことができる。 • コードを行単位で評価し結果を直接表示することができて、変数や関数オブジェクト の状態を確認する事ができて、デバッグがしやすくなる。 • Rubyだと binding.irb がイメージしやすい ◦ https://github.com/ruby/irb
© 2012-2023 BASE, Inc. PsySHの紹介 11 (https://github.com/ruby/irb) irb の例
© 2012-2023 BASE, Inc. PsySHの紹介 12 Psyshで同様の事を実行した例
© 2012-2023 BASE, Inc. PsySHの紹介 13 (https://github.com/ruby/irb)
© 2012-2023 BASE, Inc. 基本的な使い方について
© 2012-2023 BASE, Inc. 基本的な使い方について 15 インストール方法
© 2012-2023 BASE, Inc. 基本的な使い方について 16 呼び出し方について スクリプト内で呼び出す方法 ターミナルから呼び出す方法
© 2012-2023 BASE, Inc. 基本的な使い方について 17 var_dumpでデバッグした例
© 2012-2023 BASE, Inc. 基本的な使い方について 18 var_dumpでデバッグした例
© 2012-2023 BASE, Inc. 基本的な使い方について 19 psyshでデバッグした例
© 2012-2023 BASE, Inc. 基本的な使い方について 20 psyshでデバッグした例
© 2012-2023 BASE, Inc. おすすめのデバッグ方法
© 2012-2023 BASE, Inc. おすすめのデバッグ方法について 22
© 2012-2023 BASE, Inc. おすすめのデバッグ方法について 23 lsを使ってみる
© 2012-2023 BASE, Inc. おすすめのデバッグ方法について 24 lsを使ってみる
© 2012-2023 BASE, Inc. おすすめのデバッグ方法について 25 showを使ってみる
© 2012-2023 BASE, Inc. おすすめのデバッグ方法について 26 showを使ってみる
© 2012-2023 BASE, Inc. おすすめのデバッグ方法について 27
© 2012-2023 BASE, Inc. おすすめのデバッグ方法について 28 「$_ 」で直近の結果が取得できる
© 2012-2023 BASE, Inc. まとめ
© 2012-2023 BASE, Inc. 30 まとめ • PsySHについて紹介しました • PsySHを使う事で対話的にデバッグができて、素早く検証が出
来る! • 「PHPStorm + Xdebug」でも素早くデバッグができるが ちょっとした検証であれば PsySH でも十分に良い ◦ PHPで競技プログラミングをやっていると凄い助かる • デバッグ方法を極めて良い PHPer Lifeを!
© 2012-2023 BASE, Inc. 31 Thanks for listening !
© 2012-2023 BASE, Inc. 参考文献
© 2012-2023 BASE, Inc. 33 参考文献 • https://github.com/bobthecow/psysh • https://www.sitepoint.com/interactive-php-debugging-psysh/
• http://justinhileman.info/projects/ • https://github.com/bobthecow/psysh/wiki/Magic-variables • https://www.phper.ninja/entry/2015/11/10/031000 • https://github.com/bobthecow/psysh/wiki/Commands
More Decks by Futoshi Endo
See All by Futoshi Endo
【PHPカンファレンス小田原2026】Webアプリケーションエンジニアにも知ってほしい オブザーバビリティ の本質
fendo181
0
1.8k
【PHPerKaigi2026】OpenTelemetry SDKを使ってPHPでAPMを自作する
fendo181
2
550
AI時代におけるドメイン駆動設計 入門 / Introduction to Domain-Driven Design in the AI Era
fendo181
0
1.5k
【PHPカンファレンス小田原2025】New RelicのAPMを活用したECサービスにおけるメール遅延解消の舞台裏
fendo181
1
4.6k
PHP8の機能を使って堅牢にコードを書く
fendo181
7
8.6k
Introduction to Typing Practice
fendo181
0
1.3k
PHP8によるデザインパターン入門 / Introduction to Design Patterns with PHP8
fendo181
2
5.1k
PHPerがGoに入門してみた/PHPer introduction to Go.
fendo181
0
6.1k
Laravel.shibuyaで改善してきた IRT勉強会の運営方法について / IRT Study Session Improved Through Laravel Shibuya
fendo181
0
2.7k
Other Decks in Programming
See All in Programming
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.3k
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
970
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
330
Railsバージョンを4倍にした話
optim
0
1k
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
250
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
260
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
370
AI Augmentation Techniques with Liberty
ivargrimstad
1
450
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
350
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.5k
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
370
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
120
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
A better future with KSS
kneath
240
18k
Utilizing Notion as your number one productivity tool
mfonobong
4
640
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Test your architecture with Archunit
thirion
2
2.5k
Designing Powerful Visuals for Engaging Learning
tmiket
1
650
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
480
Site-Speed That Sticks
csswizardry
13
1.6k
Technical Leadership for Architectural Decision Making
baasie
4
640
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Building Applications with DynamoDB
mza
96
7.3k