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
2
1.4k
Debug interactively PHP BLT #7
Sota Sugiura
May 22, 2017
Tweet
Share
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
1.5k
20220926_セキュリティチームの今_for_Drs._Prime_公開用.pdf
sota1235
0
120
再発防止策を考える技術 / #phpconsen
sota1235
10
3.8k
How to choose the best npm module for your team?
sota1235
9
590
Realtime Database for high traffic production application
sota1235
7
4k
Road to migrate JP Web as a microservice
sota1235
4
1.6k
インターフェース再入門 / Think Interface again
sota1235
6
11k
再発防止策を考える技術 #phpconfuk_rej
sota1235
1
1.2k
Update around Firebase #io18
sota1235
3
4.3k
Other Decks in Technology
See All in Technology
地に足の付いた現実的な技術選定から魔力のある体験を得る『AIレシート読み取り機能』のケーススタディ / From Grounded Tech Choices to Magical UX: A Case Study of AI Receipt Scanning
moznion
5
1.9k
CARTA HOLDINGS エンジニア向け 採用ピッチ資料 / CARTA-GUIDE-for-Engineers
carta_engineering
0
28k
Tailwind CSS の小話「コンテナークエリーって便利」
yamaday
0
150
4社統合におけるマスタデータ管理に立ち向かう / Towards master data management in the four-company integration
carta_engineering
0
270
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
3
730
Google Cloud Next 2025 Recap マーケティング施策の運用及び開発を支援するAIの活用 / Use of AI to support operation and development of marketing campaign
atsushiyoshikawa
0
400
猫でもわかるS3 Tables【Apache Iceberg編】
kentapapa
2
270
非同期処理でも分散トレーシングしたい!- OpenTelemetry × Pub/Sub -
phaya72
1
100
encoding/json v2を予習しよう!
yuyu_hf
PRO
1
220
SONiCにて使用されているSAIの実際
sonic
0
290
ゆるくはじめるSLI・SLO
yatoum
1
120
株式会社Awarefy(アウェアファイ)会社説明資料 / Awarefy-Company-Deck
awarefy
3
17k
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
105
19k
Being A Developer After 40
akosma
91
590k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Six Lessons from altMBA
skipperchong
28
3.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
Typedesign – Prime Four
hannesfritz
41
2.6k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.7k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Designing for humans not robots
tammielis
253
25k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
179
53k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
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