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
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
More Decks by Futoshi Endo
See All by Futoshi Endo
【PHPカンファレンス小田原2026】Webアプリケーションエンジニアにも知ってほしい オブザーバビリティ の本質
fendo181
0
1.5k
【PHPerKaigi2026】OpenTelemetry SDKを使ってPHPでAPMを自作する
fendo181
2
440
AI時代におけるドメイン駆動設計 入門 / Introduction to Domain-Driven Design in the AI Era
fendo181
0
1.3k
【PHPカンファレンス小田原2025】New RelicのAPMを活用したECサービスにおけるメール遅延解消の舞台裏
fendo181
1
4.4k
PHP8の機能を使って堅牢にコードを書く
fendo181
7
8.3k
Introduction to Typing Practice
fendo181
0
1.2k
PHP8によるデザインパターン入門 / Introduction to Design Patterns with PHP8
fendo181
2
4.9k
PHPerがGoに入門してみた/PHPer introduction to Go.
fendo181
0
6k
Laravel.shibuyaで改善してきた IRT勉強会の運営方法について / IRT Study Session Improved Through Laravel Shibuya
fendo181
0
2.6k
Other Decks in Programming
See All in Programming
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
3.6k
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
220
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
210
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
260
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
210
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
600
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
150
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
480
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
210
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
150
テーブルをDELETEした
yuzneri
0
140
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
160
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
360
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
360
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
270
Joys of Absence: A Defence of Solitary Play
codingconduct
1
430
Accessibility Awareness
sabderemane
1
170
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
How GitHub (no longer) Works
holman
316
150k
Making Projects Easy
brettharned
120
6.7k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
230
Transcript
© 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