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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
130
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
170
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
330
小さなアプリを作って公開するまで
onozaty
0
170
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
420
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3.2k
LLM 101
dalinaum
0
480
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
Getting Started with Vibe Coding
miccheng
0
200
はじめてのPLATEAU
nokonoko1203
1
640
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
650
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
300
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
470
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
69k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
920
The Cost Of JavaScript in 2023
addyosmani
56
10k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
370
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
Odyssey Design
rkendrick25
PRO
3
940
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
520
Accessibility Awareness
sabderemane
1
300