Download the PHP package sil/route-security-bundle without Composer

On this page you can find all versions of the php package sil/route-security-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package route-security-bundle

Scrutinizer Code Quality Build Status Code Coverage SymfonyInsight

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

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

Installation

Composer

composer require sil/route-security-bundle

Register the bundle

Add routes configuration

Routes are only required if you want to use the Javascript part of this bundle.

Configuration

You can configure the bundle under the sil_route_security key.

Options

Enable access control

By default, the access control is disable.

List of secured routes

You can define a list of secured routes :

Secured routes format

In addition or instead of secured routes list, you can define a regex format to configure a set of routes to be secured :

List of ignored routes

You can define a list of ignored routes :

Ignored routes format

In addition or instead of ignored routes list, you can define a regex format to configure a set of routes to be not secured :

Naming strategy

By default, to generate a role for route, the bundle convert the route name to ROLE_.strtoupper($route_name). If you want a different format, you can make your hown converter. Just create a service that implement the NamingStrategyInterface and configure the bundle option with your service identifier.

Roles provider

All generated roles is accessible through the sil_route_security.roles_provider service.

For exemple, you can inject this service into your UserFormType to configure the associates roles to an user.

Adapt template view

The bundle expose :

Twig

hasUserAccessToRoute

hasUserAccessAtLeastOneRoute

hasUserAccessToRoutes

Javascript

Installation

To load it globally, add the following line to your template:

Usage

Access denied behavior

When user access to secured route and does not have the right, an AccessDeniedException is throw. The framework will convert it to a 403 response. Just before that, the event AccessDeniedToRouteEvent is dispatch. You can listen it and implement your hown behaviour, logging the action for exemple, return a custom response, redirect, whatever...


All versions of route-security-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/framework-bundle Version ^6.0 || ^7.0
symfony/security-core Version ^6.0 || ^7.0
symfony/yaml Version ^6.0 || ^7.0
symfony/expression-language Version ^6.0 || ^7.0
twig/twig Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sil/route-security-bundle contains the following files

Loading the files please wait ....