This bundle provides a way to configure your controllers with annotations and PHP attributes.
Note: This bundle is maintained for backward compatibility. For new projects, consider using native PHP attributes as added in Symfony core. For full support, use Symfony 6.2+.
- Annotations Support: Configure controllers using Doctrine annotations
- PHP Attributes Support: Configure controllers using PHP 8.0+ attributes
- Symfony 7 Compatibility: Full compatibility with Symfony 7.0+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
/**
* @Template("default/index.html.twig")
* @IsGranted("ROLE_USER")
*/
public function index()
{
// ...
}
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
#[Template('default/index.html.twig')]
#[IsGranted('ROLE_USER')]
public function index()
{
// ...
}
Read about it on its official homepage.