SlideShare a Scribd company logo
THE SYMFONY CLI 
DIGITAL POETS SOCIETY - SYMFONY2 MEETUP (MELBOURNE) 
Tom Corrigan / @thetommygnr
ABOUT ME 
Developing Symfony apps since 2.0 
Lead Developer of 
crscertus.com.au 
Co-Founder of 
rostercloud.com 
Attended Symfony Live 2012 in Paris
THE CONSOLE ITSELF 
$ app/console 
Symfony version 2.5.3 - app/dev/debug 
Usage: 
[options] command [arguments] 
Options: 
--help -h Display this help message. 
--quiet -q Do not output any message. 
--verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for 
--version -V Display this application version. 
--ansi Force ANSI output. 
--no-ansi Disable ANSI output. 
--no-interaction -n Do not ask any interactive question. 
--shell -s Launch the shell. 
--process-isolation Launch commands from shell as a separate process. 
--env -e The Environment name. 
--no-debug Switches off debug mode. 
Available This will commands: 
list every command registered in your application 
help Displays help for a command 
$ list app/console | grep twig 
Lists commands 
twig 
assetic 
assetic:twig:debug dump Dumps Shows all a list assets of twig to the functions, filesystem 
filters, globals and 
assets 
twig:lint Lints a template and outputs encountered errors 
assets:install Installs bundles web assets under a public web directory 
cache 
Combine it with grep 
cache:clear Clears the cache 
cache:warmup Warms up an empty cache 
config
SHORTCUT SYNTAX 
$ app/console d:s:v 
The above is equivalent to: 
$ app/console doctrine:schema:validate 
If the shortcut is ambiguous the console helps you out
COMMANDS ARE SELF DOCUMENTING 
$ app/console help twig:lint
OTHER GENERAL NOTES 
Always be aware of what environment you need to run your 
command in 
Don't use interactive mode without a good reason. It will bite 
you
THE COMMANDS 
NOW THAT WE KNOW HOW TO USE THE CONSOLE LETS 
EXPLORE THE COMMANDS
ASSETIC 
Dumps all your assets (CSS/JS) and applies all configured filters 
$ app/console assetic:dump 
Scans your files for changes and reprocesses any modified files. 
$ app/console assetic:dump --watch 
Combine this with the following configuration for a huge 
speedup in dev 
#config.yml 
assetic: 
use_controller: false
ASSETS:INSTALL 
$ app/console assets:install 
Copy Resources/public from every bundle to the web 
directory 
Symfony has a composer post install/update hook to do this for 
you 
Tip: put this in your composer.json and you'll never have to run 
this command again 
"extra": { 
"symfony-assets-install": "symlink" 
}
CACHE:CLEAR 
$ app/console cache:clear 
Clears the application cache for a given environment 
This is the first thing I try whenever I encounter weirdness 
Note the importance of specifying an environment. Each env has 
its own cache
CONFIG:DUMP-REFERENCE 
$ app/console config:dump-reference 
First run this without any arguments to see all registered bundles 
$ app/console config:dump-reference twig 
Then supply a bundle name or alias to view all configuration 
options and defaults
CONFIG:DEBUG 
$ app/console config:debug 
Very similar to config:dump-reference except that it shows your 
actual configuration 
$ app/console config:debug twig 
Like the last command you can then view the configuration for a 
bundle
CONTAINER:DEBUG 
$ app/console container:debug 
I use this heaps with grep 
$ app/console container:debug | grep form 
Also useful: 
$ app/console container:debug --tag=form.type
GENERATE:BUNDLE 
$ app/console generate:bundle 
This is the first thing I do when starting a new project
DOCTRINE:GENERATE:ENTITY 
$ app/console doctrine:generate:entity 
Fantastic for quickly stubbing out entities on the command line 
Demo!
DOCTRINE:GENERATE:CRUD 
$ app/console doctrine:generate:crud 
Creates a form type, controller and templates 
Another massive timesaver
DOCTRINE:GENERATE:ENTITIES 
$ app/console doctrine:generate:entities 
Creates entity class from your mapping 
The secret trick is it safely updates existing entities too!
OTHER HANDY DOCTRINE COMMANDS 
doctrine:database:create Creates the configured databases 
doctrine:database:drop Drops the configured databases 
doctrine:mapping:convert Convert mapping information between supported formats. 
doctrine:mapping:import Imports mapping information from an existing database 
doctrine:mapping:info Shows basic information about all mapped entities 
doctrine:query:dql Executes arbitrary DQL directly from the command line. 
doctrine:query:sql Executes arbitrary SQL directly from the command line. 
doctrine:schema:create Executes (or dumps) the SQL needed to generate the database doctrine:schema:drop Executes (or dumps) the SQL needed to drop the current doctrine:schema:update Executes (or dumps) the SQL needed to update the database doctrine:schema:validate Validates the doctrine mapping files
SECURITY:CHECK 
$ app/console security:check 
Sends your composer.lock file to the 
SensioLabs Security 
to see if any dependencies have know security issues 
Checker 
Work this in to your CI environment!
SERVER:RUN 
$ app/console server:run 
Spin up a webserver on 
localhost:8000 
Single threaded, so serving assets takes a while 
PHP 5.4+ 
It should go without saying but don't use this in production!
THANKS

More Related Content

PPTX
Flask vs. Django
PPTX
The Shellshocker
PDF
NoGUI maXbox Starter70
PPTX
Using Visual Studio to build XAML Universal Apps
RTF
appledoc_style
PDF
Symfony Nano Framework
PDF
Elixir on Containers
PPT
Write book in markdown
Flask vs. Django
The Shellshocker
NoGUI maXbox Starter70
Using Visual Studio to build XAML Universal Apps
appledoc_style
Symfony Nano Framework
Elixir on Containers
Write book in markdown

What's hot (18)

PDF
Containerize spring boot application with docker
KEY
Cramp websockets
PPTX
Getting started with PHPUnit
PDF
Flask Introduction - Python Meetup
KEY
Rails3ハンズオン資料
PDF
Docker Cheatsheet_01
PDF
Play on Docker
DOCX
Generating keyboard in raspberry pi
PDF
Using HttpKernelInterface for Painless Integration
PDF
Chapter 2 - Structure of C++ Program
PDF
Python Flask app deployed to OPenShift using Wercker CI
PPTX
Intro To C++ - Class 03 - An Introduction To C++ Programming, Part II
PDF
Repeatable Deployments and Installations
PDF
Writing simple buffer_overflow_exploits
PDF
HOW TO DEAL WITH BLOCKING CODE WITHIN ASYNCIO EVENT LOOP
PPTX
PPTX
Code igniter unittest-part1
PDF
Silex: From nothing to an API
Containerize spring boot application with docker
Cramp websockets
Getting started with PHPUnit
Flask Introduction - Python Meetup
Rails3ハンズオン資料
Docker Cheatsheet_01
Play on Docker
Generating keyboard in raspberry pi
Using HttpKernelInterface for Painless Integration
Chapter 2 - Structure of C++ Program
Python Flask app deployed to OPenShift using Wercker CI
Intro To C++ - Class 03 - An Introduction To C++ Programming, Part II
Repeatable Deployments and Installations
Writing simple buffer_overflow_exploits
HOW TO DEAL WITH BLOCKING CODE WITHIN ASYNCIO EVENT LOOP
Code igniter unittest-part1
Silex: From nothing to an API
Ad

Similar to The Symfony CLI (20)

PDF
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
PDF
Improve your web and app development with the Symfony3 framework.
PDF
Symfony tips and tricks
PDF
Symfony2 - from the trenches
ODP
Running Symfony
PDF
Create a Symfony Application from a Drupal Perspective
PDF
Symfony metabook 2.0
PDF
Efficient development workflows with composer
PDF
Efficient development workflows with composer
PDF
Symfony Components
PDF
Symfony Components
PDF
Symfony Components
PDF
Symfony2 from the Trenches
PDF
Symfony workshop introductory slides
PDF
An Introduction to Symfony
PDF
Improving your Drupal 8 development workflow DrupalCampLA
PPTX
Console presentation
PPTX
Console presentation
PDF
Symfony 4: A new way to develop applications #ipc19
PDF
Deploying Symfony | symfony.cat
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Improve your web and app development with the Symfony3 framework.
Symfony tips and tricks
Symfony2 - from the trenches
Running Symfony
Create a Symfony Application from a Drupal Perspective
Symfony metabook 2.0
Efficient development workflows with composer
Efficient development workflows with composer
Symfony Components
Symfony Components
Symfony Components
Symfony2 from the Trenches
Symfony workshop introductory slides
An Introduction to Symfony
Improving your Drupal 8 development workflow DrupalCampLA
Console presentation
Console presentation
Symfony 4: A new way to develop applications #ipc19
Deploying Symfony | symfony.cat
Ad

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation theory and applications.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Cloud computing and distributed systems.
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPT
Teaching material agriculture food technology
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
NewMind AI Weekly Chronicles - August'25 Week I
Programs and apps: productivity, graphics, security and other tools
Per capita expenditure prediction using model stacking based on satellite ima...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine learning based COVID-19 study performance prediction
Encapsulation theory and applications.pdf
Understanding_Digital_Forensics_Presentation.pptx
cuic standard and advanced reporting.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Cloud computing and distributed systems.
MIND Revenue Release Quarter 2 2025 Press Release
Teaching material agriculture food technology

The Symfony CLI

  • 1. THE SYMFONY CLI DIGITAL POETS SOCIETY - SYMFONY2 MEETUP (MELBOURNE) Tom Corrigan / @thetommygnr
  • 2. ABOUT ME Developing Symfony apps since 2.0 Lead Developer of crscertus.com.au Co-Founder of rostercloud.com Attended Symfony Live 2012 in Paris
  • 3. THE CONSOLE ITSELF $ app/console Symfony version 2.5.3 - app/dev/debug Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for --version -V Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction -n Do not ask any interactive question. --shell -s Launch the shell. --process-isolation Launch commands from shell as a separate process. --env -e The Environment name. --no-debug Switches off debug mode. Available This will commands: list every command registered in your application help Displays help for a command $ list app/console | grep twig Lists commands twig assetic assetic:twig:debug dump Dumps Shows all a list assets of twig to the functions, filesystem filters, globals and assets twig:lint Lints a template and outputs encountered errors assets:install Installs bundles web assets under a public web directory cache Combine it with grep cache:clear Clears the cache cache:warmup Warms up an empty cache config
  • 4. SHORTCUT SYNTAX $ app/console d:s:v The above is equivalent to: $ app/console doctrine:schema:validate If the shortcut is ambiguous the console helps you out
  • 5. COMMANDS ARE SELF DOCUMENTING $ app/console help twig:lint
  • 6. OTHER GENERAL NOTES Always be aware of what environment you need to run your command in Don't use interactive mode without a good reason. It will bite you
  • 7. THE COMMANDS NOW THAT WE KNOW HOW TO USE THE CONSOLE LETS EXPLORE THE COMMANDS
  • 8. ASSETIC Dumps all your assets (CSS/JS) and applies all configured filters $ app/console assetic:dump Scans your files for changes and reprocesses any modified files. $ app/console assetic:dump --watch Combine this with the following configuration for a huge speedup in dev #config.yml assetic: use_controller: false
  • 9. ASSETS:INSTALL $ app/console assets:install Copy Resources/public from every bundle to the web directory Symfony has a composer post install/update hook to do this for you Tip: put this in your composer.json and you'll never have to run this command again "extra": { "symfony-assets-install": "symlink" }
  • 10. CACHE:CLEAR $ app/console cache:clear Clears the application cache for a given environment This is the first thing I try whenever I encounter weirdness Note the importance of specifying an environment. Each env has its own cache
  • 11. CONFIG:DUMP-REFERENCE $ app/console config:dump-reference First run this without any arguments to see all registered bundles $ app/console config:dump-reference twig Then supply a bundle name or alias to view all configuration options and defaults
  • 12. CONFIG:DEBUG $ app/console config:debug Very similar to config:dump-reference except that it shows your actual configuration $ app/console config:debug twig Like the last command you can then view the configuration for a bundle
  • 13. CONTAINER:DEBUG $ app/console container:debug I use this heaps with grep $ app/console container:debug | grep form Also useful: $ app/console container:debug --tag=form.type
  • 14. GENERATE:BUNDLE $ app/console generate:bundle This is the first thing I do when starting a new project
  • 15. DOCTRINE:GENERATE:ENTITY $ app/console doctrine:generate:entity Fantastic for quickly stubbing out entities on the command line Demo!
  • 16. DOCTRINE:GENERATE:CRUD $ app/console doctrine:generate:crud Creates a form type, controller and templates Another massive timesaver
  • 17. DOCTRINE:GENERATE:ENTITIES $ app/console doctrine:generate:entities Creates entity class from your mapping The secret trick is it safely updates existing entities too!
  • 18. OTHER HANDY DOCTRINE COMMANDS doctrine:database:create Creates the configured databases doctrine:database:drop Drops the configured databases doctrine:mapping:convert Convert mapping information between supported formats. doctrine:mapping:import Imports mapping information from an existing database doctrine:mapping:info Shows basic information about all mapped entities doctrine:query:dql Executes arbitrary DQL directly from the command line. doctrine:query:sql Executes arbitrary SQL directly from the command line. doctrine:schema:create Executes (or dumps) the SQL needed to generate the database doctrine:schema:drop Executes (or dumps) the SQL needed to drop the current doctrine:schema:update Executes (or dumps) the SQL needed to update the database doctrine:schema:validate Validates the doctrine mapping files
  • 19. SECURITY:CHECK $ app/console security:check Sends your composer.lock file to the SensioLabs Security to see if any dependencies have know security issues Checker Work this in to your CI environment!
  • 20. SERVER:RUN $ app/console server:run Spin up a webserver on localhost:8000 Single threaded, so serving assets takes a while PHP 5.4+ It should go without saying but don't use this in production!