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
SymfonyCon 2013 Lightning Talk about the Consol...
Search
Fabien Potencier
December 13, 2013
Programming
1.3k
10
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SymfonyCon 2013 Lightning Talk about the Console in 2.5
Fabien Potencier
December 13, 2013
More Decks by Fabien Potencier
See All by Fabien Potencier
20 years of Symfony, what's next?
fabpot
2
590
How AI agents are changing the way we should build APIs
fabpot
1
610
What is Symfony?
fabpot
1
270
Symfony in 2025: Scaling to 0
fabpot
3
850
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
4
1.9k
Using some Git magic on the Symfony mono-repository
fabpot
1
380
Using some Git magic on the Symfony mono-repository
fabpot
1
580
The Symfony Terminal Component
fabpot
2
1.3k
Out-of-band activities, the Scheduler component
fabpot
3
550
Other Decks in Programming
See All in Programming
Kotlinの15年とServer-Side Kotlin
n_takehata
1
190
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
280
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
160
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
610
学びを記事・スライド・Xへ高速展開する― AI-assisted Learning Loopで回すコンテンツ生成術
ochtum
0
190
SODA - FACT BOOK(EN)
sodainc
1
200
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
4
3k
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
200
SODA - FACT BOOK(JP)
sodainc
1
40k
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
130
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
120
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
180
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Odyssey Design
rkendrick25
PRO
2
920
Code Review Best Practice
trishagee
74
20k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
520
For a Future-Friendly Web
brad_frost
184
11k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
760
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Producing Creativity
orderedlist
PRO
348
41k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Transcript
Easier interaction with the user from a Console application https://secure.flickr.com/photos/sylvain_masson/4195880838
?hidden answer limited choices validator yes/no question autocompleter number of
aempts default value multiple values
ask() select() askConfirmation() askAndValidate() askHiddenResponse() AskHiddenResponseAndValidate()
select ask askConfirmation askHiddenResponse AskAndValidate askHiddenResponseAn dValidate aempts Y Y
Y Y hidden answer Y Y autocompleter Y Y validator Y Y Y default value Y Y Y Y yes/no Y choices Y
AskAQuestionWithALimitedSe tOfChoicesButLetTheUserPro videAFreeTextAnswerIfHeWan tsToButOfCourseHideTheResp onseAndPleaseValidateTheAn swerInAWayThatEmptyReturns APredefinedDefaultValue()
From the Dialog Helper to the Question Helper 2.5
QuestionHelper::ask( OutputInterface $output, Question $question )
use Symfony\Component\Console\Dialog\Question; $helper = $this->getHelper('question'); $question = new Question('Enter your
full name: '); $name = $helper->ask($output, $question);
$question = new Question('Enter your full name: ', 'me');
$question->setHidden(true);
$question->setAutocompleter(array('one', 'two', '...'));
$question->setMaxAttemps(5);
$question->setValidator(function ($value) { if (!empty($value)) { return $value; } throw
new \InvalidArgumentException( 'You need to provide a non-empty value.'); });
$question = new ChoiceQuestion('Choose a color', array('red', 'blue'), 'blue'); $question->setMultiselect(true);
$question->setPrompt(' > '); $question->setErrorMessage("That's not a valid color!");
new ConfirmationQuestion('Is it better?', true); 2.5
Better feedback when running external processes from a Console application
https://secure.flickr.com/photos/petergorges/3052698754
$process = new Process('ls -lsa'); $process->run(); $output->writeln($process->getOutput());
$callback = function ($type, $buffer) use ($output) { $output->write($buffer); };
$process->run(OutputInterface::VERBOSITY_VERBOSE < $output- >getVerbosity() ? $callback : null);
$callback = function ($type, $buffer) use ($output, &$startedOut, &$startedErr) {
if ('err' === $type) { if (!$startedErr) { $output->write("\n<bg=red;fg=white> ERR </> "); $startedErr = true; $startedOut = false; } $output->write(str_replace("\n", "\n<bg=red;fg=white> ERR </> ", $buffer)); } else { if (!$startedOut) { $output->write("\n<bg=green;fg=white> OUT </> "); $startedOut = true; $startedErr = false; } $output->write(str_replace("\n", "\n<bg=green;fg=white> OUT </> ", $buffer)); } };
None
$helper = $this->getHelper('process'); $process = $helper->run($output, 'ls -lsa'); $output->writeln($process->getOutput()); 2.5
$helper->run($output, 'ls -lsa'); $helper->run($output, 'run foobar'); ./app/console ... -vv
$helper->run($output, 'ls -lsa'); ./app/console ... -vvv
./app/console ... -vvv $helper->run($output, 'run foobar');
$helper = $this->getHelper('process'); $process = new Process('ls -lsa'); $helper->run($output, $process);
$output->writeln($process->getOutput()); 2.5
$callback = function ($type, $buffer) { error_log($buffer); }; $helper->run($output, $process,
null, $callback); 2.5
What about debugging HTTP requests?
use Guzzle\Http\Client; $client->get('http://example.com/')->send();
use Guzzle\Http\Client; $client = new Client(); $client->addSubscriber(new GuzzleConsolePlugin( $output, $this->getHelper('debug_formatter'))
); $client->get('http://example.com/')->send(); 2.5
./app/console ... -vv $client->get('http://example.com/')->send(); $client->get('http://symfony.com/foobar')->send();
./app/console ... -vv $client->get('http://insight.sensiolabs.com/')->send();
None
$formatter = $this->getHelperSet()->get('debug_formatter'); // start a session $start = $formatter->start($uuid,
$cmd); $output->write($start); // give some feedback $progress = $formatter->progress($uuid, $buffer, $isError); $output->write($progress); // at the end $stop = $formatter->stop($uuid, $message, $isSuccessful); $output->write($stop); 2.5