Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
security:
firewalls:
main:
lazy: true
provider: app_user_provider
form_login:
login_path: app_login
check_path: app_login
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
php bin/console make:auth
security:
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
composer require symfony/security-bundle
php bin/console make:user
$user = $this->getUser();
use Symfony\Component\Security\Http\Attribute\IsGranted;
#[IsGranted('ROLE_ADMIN')]
{% if is_granted('ROLE_ADMIN') %}
<a href="...">Panneau d'administration</a>
{% endif %}
$this->denyAccessUnlessGranted('ROLE_ADMIN');