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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
390
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
560
Other Decks in Programming
See All in Programming
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
250
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
370
学びを記事・スライド・Xへ高速展開する― AI-assisted Learning Loopで回すコンテンツ生成術
ochtum
0
200
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
420
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
740
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.3k
はじめてのPLATEAU
nokonoko1203
1
630
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
190
小さなアプリを作って公開するまで
onozaty
0
150
SODA - FACT BOOK(JP)
sodainc
1
40k
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
290
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
4
3.7k
Featured
See All Featured
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Deep Space Network (abreviated)
tonyrice
0
410
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Building AI with AI
inesmontani
PRO
1
1.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
560
Testing 201, or: Great Expectations
jmmastey
46
8.4k
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