Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Login Form Bundle Laravel Package

chebur/login-form-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle to your Symfony project via Composer:

    composer require chebur/login-form-bundle
    

    Enable the bundle in config/bundles.php:

    Chebur\LoginFormBundle\CheburLoginFormBundle::class => ['all' => true],
    
  2. Configuration Publish the default config:

    php bin/console chebur:login-form:install
    

    Update config/packages/chebur_login_form.yaml with your security provider (e.g., security.user.provider.concrete).

  3. First Use Case Use the provided Twig extension to render the login form in a template:

    {{ render(chebur_login_form('app.login')) }}
    

    Ensure you have a route (app.login) pointing to a controller handling the form submission.


Implementation Patterns

Workflow Integration

  1. Form Customization Extend the default form behavior by overriding the form type in config/packages/chebur_login_form.yaml:

    chebur_login_form:
        form_type: App\Form\CustomLoginType
    

    Create a custom form type extending Chebur\LoginFormBundle\Form\LoginType.

  2. Authentication Workflow Handle login logic in a controller:

    use Chebur\LoginFormBundle\Security\LoginFormAuthenticator;
    
    public function login(LoginFormAuthenticator $authenticator, Request $request)
    {
        return $authenticator->authenticate($request);
    }
    
  3. CSRF Protection The bundle auto-generates CSRF tokens. Ensure your form includes:

    {{ form_row(form._token) }}
    
  4. Flash Messages Use Symfony’s flash system for success/error messages:

    $this->addFlash('success', 'Login successful!');
    
  5. Integration with Security Configure the firewall in config/packages/security.yaml:

    firewalls:
        main:
            form_login:
                provider: app.user_provider
                authenticator: Chebur\LoginFormBundle\Security\LoginFormAuthenticator
    

Gotchas and Tips

Pitfalls

  1. Deprecated Symfony Version The bundle was last updated in 2019 and may not support Symfony 6+. Test thoroughly or fork the package for compatibility.

  2. Missing Documentation The README is minimal. Refer to the Symfony Security Component for advanced use cases.

  3. CSRF Token Mismatch If tokens fail, clear cache:

    php bin/console cache:clear
    
  4. Form Type Overrides Ensure your custom form type extends the correct base class (Chebur\LoginFormBundle\Form\LoginType) to avoid missing fields (e.g., _csrf_token).

Debugging Tips

  1. Enable Debug Mode Set APP_DEBUG=true in .env to log form submission errors.

  2. Check Event Listeners The bundle dispatches chebur.login_form.submit events. Subscribe to debug submission data:

    // src/EventListener/LoginDebugListener.php
    public function onLoginSubmit(LoginFormEvent $event) {
        dump($event->getData());
    }
    
  3. Database Queries Use Symfony’s profiler (/profiler) to verify user provider queries during login.

Extension Points

  1. Custom Authenticators Extend LoginFormAuthenticator to add logic (e.g., 2FA):

    class CustomAuthenticator extends LoginFormAuthenticator {
        public function checkCredentials($credentials) {
            // Custom validation
        }
    }
    
  2. Twig Extensions Override the render() method in Chebur\LoginFormBundle\Twig\LoginFormExtension for custom templates.

  3. Configuration Overrides Dynamically adjust form options via dependency injection:

    services:
        Chebur\LoginFormBundle\Form\LoginType:
            arguments:
                $rememberMe: '%kernel.debug%'
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope