PHPackages                             sil/route-security-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. sil/route-security-bundle

ActiveSymfony-bundle[Security](/categories/security)

sil/route-security-bundle
=========================

Provide a way to secure accesses to all routes of an symfony application.

2.4.0(1mo ago)78.8k↓22.9%1MITPHPPHP &gt;=8.1CI failing

Since Apr 13Pushed 1mo agoCompare

[ Source](https://github.com/SimLibaud/SilRouteSecurityBundle)[ Packagist](https://packagist.org/packages/sil/route-security-bundle)[ RSS](/packages/sil-route-security-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (18)Versions (20)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/54a4b44310fc4fd96660ff60528ffa888979dbcd47342b3cfae355da2f887a46/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53696d4c69626175642f53696c526f757465536563757269747942756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SimLibaud/SilRouteSecurityBundle/?branch=master)[![Build Status](https://camo.githubusercontent.com/c480471d9306c2e453a7b0ce2a49798844561d2d10da2f3b7f115efeb937c9d6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53696d4c69626175642f53696c526f757465536563757269747942756e646c652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SimLibaud/SilRouteSecurityBundle/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/cc2c36d74258a59c075d7c3c1b3a8f09ec31fb9b7dfd4ca5ae39d8d051f10fa5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53696d4c69626175642f53696c526f757465536563757269747942756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SimLibaud/SilRouteSecurityBundle/?branch=master)[![SymfonyInsight](https://camo.githubusercontent.com/e867407c0b3251f00de41eb56259612157f39a7fecec341b41e5453f870dab18/68747470733a2f2f696e73696768742e73796d666f6e792e636f6d2f70726f6a656374732f30666537643764342d363066662d346631632d613132662d6339396436353130666166622f6d696e692e737667)](https://insight.symfony.com/projects/0fe7d7d4-60ff-4f1c-a12f-c99d6510fafb)

SilRouteSecurityBundle
======================

[](#silroutesecuritybundle)

This bundle provide a way to secure accesses to all routes of your application and adapt the view according to the logged user.

Principle
=========

[](#principle)

- The bundle generate roles for all configured routes.
- The bundle listen the `kernel.request` event and retrieve the requested route.
- If the route is configure to be secured, the bundle check if the current user has the appropriate role. If not, an AccessDeniedException from Symfony security component is throw. You will see above how to modify this behaviour.

For all routes configured in access control, the user must be authenticated and implement the `UserInterface` of Symfony security component.

Installation
============

[](#installation)

Composer
--------

[](#composer)

`composer require sil/route-security-bundle`

Register the bundle
-------------------

[](#register-the-bundle)

```
