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
Debug interactively PHP BLT #7
Search
Sota Sugiura
May 22, 2017
Technology
1.5k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Debug interactively PHP BLT #7
Sota Sugiura
May 22, 2017
More Decks by Sota Sugiura
See All by Sota Sugiura
内製したSlack Appで頑張るIncident Response@Waroom Meetup #1 / Incident Response with Slack App in 10X
sota1235
0
2k
20220926_セキュリティチームの今_for_Drs._Prime_公開用.pdf
sota1235
0
200
再発防止策を考える技術 / #phpconsen
sota1235
10
4.1k
How to choose the best npm module for your team?
sota1235
9
670
Realtime Database for high traffic production application
sota1235
7
4.3k
Road to migrate JP Web as a microservice
sota1235
4
1.8k
インターフェース再入門 / Think Interface again
sota1235
6
11k
再発防止策を考える技術 #phpconfuk_rej
sota1235
1
1.4k
Update around Firebase #io18
sota1235
3
4.5k
Other Decks in Technology
See All in Technology
Alphaモジュール使っていいのかい!?いけないのかい!?どっちなんだいっ!?
watany
1
290
SRE依存からの脱却 運用を開 発チームへ移す、 フルサイ クル開 発体制の実践
joooee0000
0
3.2k
発表と総括 / Presentations and Summary
ks91
PRO
0
140
ZOZOTOWNの進化と信頼性を両立する負荷試験
zozotech
PRO
2
270
しくみを学んで使いこなそう GitHub Copilot app
torumakabe
2
290
AI時代のYAGNI:「爆速で無駄になった機能」からの学び / 20260720 Naoki Takahashi
shift_evolve
PRO
3
340
AIコード生成×サプライチェーン攻撃 — PHPが直面する“二重の信頼問題
shinyasaita
0
220
[2026-07-15] AI Ready なはずだったアーキテクチャと、見えてきた課題・次に目指す状態
wxyzzz
9
4k
知らん間に、回ってる
ming_ayami
0
740
2年前に削除したPHPクラスが、 ある日突然決済をエラーにした
ykagano
1
430
AI時代の開発生産性は、個人技からチーム設計へ
moongift
PRO
4
2.4k
Genie Ontologyは銀の弾丸かを考える / Is Genie Ontology a Silver Bullet?
nttcom
0
410
Featured
See All Featured
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
490
It's Worth the Effort
3n
188
29k
Context Engineering - Making Every Token Count
addyosmani
9
1k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
350
How to Talk to Developers About Accessibility
jct
2
400
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
GitHub's CSS Performance
jonrohan
1033
470k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.8k
Music & Morning Musume
bryan
47
7.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Design in an AI World
tapps
1
260
Transcript
Debug interactively @sota1235
var_dump($sota1235); • @sota1235 • Call me ‘kirin’ • PHP &
JavaScript • Mercari, Inc.
http://sota1235.hatenablog.com/entry/2017/01/01/175228
I did it
Today’s theme
Debug
Debugging method • Using var_dump, echo • php -a •
Writing tests • IDE • etc…
Debugging method • Using var_dump, echo • php -a •
Writing tests • IDE • etc…
Using REPL (php -a) • Easy to use • Can
load files • Good integration with CLI
Is it the best way? • Bother to require autoloader
• Reset state every time • Not good for many autoloader files…
None
psysh http://psysh.org/
psysh • Rich CLI • Customizable • We can make
own REPL
Rich REPL • Auto complete (with Tab key) • Useful
commands • history, documentation, show properties • Rich UI
Customizable • We can place config file • ~/.config/psysh/psysh.php •
We can do anything if PHP can
<?php // Automatically autoload Composer dependencies if (is_file(getcwd() . '/vendor/autoload.php'))
{ require_once(getcwd() . '/vendor/autoload.php'); } Load composer automatically
<?php // Use local config, if available if (is_file(getcwd() .
'/.psysh.php')) { return require(getcwd() . '/.psysh.php'); } // Fall back to global config return [ 'startupMessage' => '<info>Using global config</info>', 'commands' => [ new \Psy\Command\ParseCommand, ], ]; Load local config
<?php $default_includes = []; // Automatically autoload Composer dependencies if
(is_file(getcwd() . '/vendor/autoload.php')) { $default_includes[] = getcwd() . '/vendor/autoload.php'); } if (array_pop(explode('/', getcwd())) === '') { $default_includes[] = getcwd() . 'lecacy_autoloader.php'; } return [ 'defaultIncludes' = $default_includes, ]; Legacy project? No problem☺
Thank you