Using YAML:
# app/config/routing.yml
blog_list:
path: /blog
defaults: { _controller: AppBundle:Blog:list }
Using Annotations:
// src/AppBundle/Controller/BlogController.php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class BlogController extends Controller
{
/**
* @Route("/blog", name="blog_list")
*/
public function listAction()
{
// ...
}
}
A request for the /blog
URL will be handled by the listAction()
method of the BlogController
inside AppBundle
.