How you can create a new controller in Symfony2 from command line

Hi guys, today i want to speak about Symfony's controllers. In this tutorial you will see how to create a controller from command line. Also I will show you how you can create a Symfony's controller manually.

To create a new controller follow this steps

  • Open command in your Symfony project.
  • And enter: php app/console generate:controller --no-interaction --controller=AcmeBlogBundle:Post
  • AcmeBlogBundle is name of your bundle.
  • Post is name of your controller.
  • In this way you can create a controller in Symfony.

To create a new controller manually, you must only copy an existing controller and change its class name.

Video tutorial:









Leave a Comment