Skip to content

Instantly share code, notes, and snippets.

@ertankayalar
Created May 7, 2018 09:49
Show Gist options
  • Select an option

  • Save ertankayalar/de0e8d8d35ec64f5533eea25f12c3f83 to your computer and use it in GitHub Desktop.

Select an option

Save ertankayalar/de0e8d8d35ec64f5533eea25f12c3f83 to your computer and use it in GitHub Desktop.
Simple Symfony Blog Controller
// src/Controller/BlogController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends Controller
{
/**
* /blog adresine ayarlı
*
* @Route("/blog", name="blog_list")
*/
public function list()
{
// ...
}
/**
* /blog/* ile başlayan adreslere ayarlı
*
* @Route("/blog/{slug}", name="blog_show")
*/
public function show($slug)
{
// $slug URL'nin dinamik parçası
// Örneğin /blog/makale-adresi adresi girilirse
// $slug='makale-adresi' olacak
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment