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
Debug interactively PHP BLT #7
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
Transcript
19 slides
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
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
2.1k
20220926_セキュリティチームの今_for_Drs._Prime_公開用.pdf
sota1235
0
230
再発防止策を考える技術 / #phpconsen
sota1235
10
4.1k
How to choose the best npm module for your team?
sota1235
9
700
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
全てを疑え!非自明な挙動と異常系から考える堅牢なカスタムコントローラ開発入門(CNDW2026)
lycorptech_jp
PRO
0
120
認知負荷の減らし方 ~開発にも日常業務にも活かせるノウハウ~
minorun365
PRO
20
18k
Well, that’s weird…
csswizardry
3
250
kubellの最新データ分析環境
kubell_hr
2
290
さようならSSH鍵、こんにちはゼロトラスト ― AIフレンドリーで快適な自宅鯖SSH
atalie2m
14
7.6k
テスト自動化の先、テスト自律化に向けて
mineo_matsuya
3
600
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
290
Ignite 2026 Security
babaneko
0
110
現場に渡し、構造で守る AI エージェントを活用したセルフサーブのデータ基盤の運用
legalontechnologies
PRO
0
150
競馬予想をAIでやってみた話
yoshimura_datam
0
150
FPGAでアクティブセンシングがやりたくてカメラモジュールを自作した話
ryuz88
0
140
データ界隈LT祭の運営のふりかえり
yoshimura_datam
0
110
Featured
See All Featured
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
480
A Tale of Four Properties
chriscoyier
163
24k
Documentation Writing (for coders)
carmenintech
77
5.7k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
630
HDC tutorial
michielstock
2
1k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
530
Agile that works and the tools we love
rasmusluckow
331
22k
エンジニアに許された特別な時間の終わり
watany
109
250k
How STYLIGHT went responsive
nonsquared
100
6.4k
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Product Roadmaps are Hard
iamctodd
55
13k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
650