Search by

kowada-gmbh / auth-bundle

tilokowalski

Shared Symfony bundle that adds account-status gating, login tracking, and login/logout flash messages to your own User entity.

Package info

github.com/Kowada-GmbH/auth-bundle

Type:symfony-bundle

pkg:composer/kowada-gmbh/auth-bundle

Statistics

Installs: 33

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.2 2026-09-22 21:14 UTC

This package is auto-updated.

Last update: 2026-09-22 21:14:43 UTC


README

CI PHP Symfony

Shared Symfony bundle that adds account-status gating, login tracking, and login/logout flash messages to your own User entity.

The bundle is maintained here as a versioned Composer dependency and pulled into individual Symfony projects via composer update kowada-gmbh/auth-bundle.

Installation

The package is public on Packagist (the source itself stays proprietary, only the distribution is public) and can be required as a regular dependency:

composer require kowada-gmbh/auth-bundle ^1.0

Features

All classes under Kowada\AuthBundle\ are automatically registered as services via autowiring/autoconfiguration (see config/services.yaml).

Login/logout behavior is wired to your own User entity via interfaces, instead of requiring a bundle-owned User class.

Configuration in the consuming project:

  1. Your own User entity must implement the interfaces you want to use. Both are independent of each other — an interface that isn't implemented is simply skipped via an instanceof check, nothing happens in that case:
    class User implements UserInterface, AccountStatusInterface, LoginTrackingInterface {
        public function isEmailVerified(): bool { /* ... */ }
        public function isApproved(): bool { /* ... */ }
    
        public function getFirstname(): string { /* ... */ }
        public function getDateTimeLoggedInInitial(): ?DateTimeInterface { /* ... */ }
        public function setDateTimeLoggedInInitial(DateTimeImmutable $dateTime) { /* ... */ }
        public function setDateTimeLoggedInLatest(DateTimeImmutable $dateTime) { /* ... */ }
    }
  2. Register UserChecker on the relevant firewall in security.yaml:
    security:
        firewalls:
            main:
                user_checker: Kowada\AuthBundle\Security\UserChecker
  3. LoginSuccessSubscriber/LogoutSubscriber are event subscribers and become active without further configuration. A session-based firewall (FlashBagAwareSessionInterface) is assumed — with stateless APIs the flash messages simply have no effect, but no error occurs either.

Translations

All text goes through the Symfony translator, domain kowada_auth (de / en). Translations are loaded automatically — symfony/translation is required by this bundle, which makes FrameworkBundle enable its translator (framework.translator) by default, so no further configuration is needed. Individual keys can be overridden in the consuming project by creating a same-named translations/kowada_auth.<locale>.yaml file there.

Development

composer install
vendor/bin/phpunit
vendor/bin/phpstan analyse