alexhenriet/common-bundle

Common stuffs used in Symfony projects

Installs: 881

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

v0.1.2 2022-05-24 11:50 UTC

This package is auto-updated.

Last update: 2024-04-24 16:13:56 UTC


README

Common stuffs used in Symfony projects.

How to install the bundle ?

  1. Create bundle configuration in config/packages/alexhenriet_common.yaml BEFORE requiring the package or you'll get an error during install (the bundle has no recipe)

    common:
        ldap_host: 'ldap-host.lan'
        # ldap_port: 389
        # ldap_opt_protocol_version: 3
        # ldap_opt_referrals: 0
        login_prefix: 'DOMAIN'
        # login_route: 'app_login'
        bypass_user_identifiers: ['MyLogin']
        bypass_environments: ['loc']
    
  2. Install the package with composer

    composer require alexhenriet/common-bundle
    
  3. Enable the package in config/bundles.php

    return [
        ...
        Alexhenriet\Bundle\CommonBundle\CommonBundle::class => ['all' => true],
    ];
    

How to use the bundle ?

Custom Authenticator

  1. Generate user and auth using commands provided by symfony/maker-bundle

  2. Replace the custom authenticator in the security.yaml

    security:
        enable_authenticator_manager: true
    
    firewalls:
        main:
            custom_authenticators:
                - Alexhenriet\Bundle\CommonBundle\Security\BypassableLdapLoginFormAuthenticator
    
  3. Use _username and _password as input names in your template\security\login.html.twig

Abstract Controller

  1. Extend the abstract controller in a controller

    use Alexhenriet\Bundle\CommonBundle\Controller\AbstractController;
    
    class ActionsController extends AbstractController
    {}
    
  2. If you get error "Controller ... cannot be fetched from the container because it is private", add the following lines to your services.yaml

    # controllers are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base controller class
    App\Controller\:
      resource: '../src/Controller/'
      tags: ['controller.service_arguments']
    

Warranty Disclaimer and Limitation of Liability

THIS FREE LIBRARY IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE AUTHOR DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE AND MERCHANTABILITY. UNDER NO CIRCUMSTANCES WILL THE AUTHOR BE LIABLE FOR ANY CONSEQUENTIAL, SPECIAL, INDIRECT, INCIDENTAL OR PUNITIVE DAMAGES WHATSOEVER ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS DO NOT ALLOW LIMITATIONS ON IMPLIED WARRANTIES OR THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU. THIS EULA WILL BE GOVERNED BY AND CONSTRUED IN ACCORDANCE WITH THE LAWS OF BELGIUM WITHOUT REGARD TO ITS CONFLICTS OF LAWS OR ITS PRINCIPLES. ANY CLAIM OR SUIT ARISING OUT OF OR RELATING TO THIS EULA WILL BE BROUGHT EXCLUSIVELY IN ANY COURT OF COMPETENT JURISDICTION LOCATED IN HAINAUT (BELGIUM).