betterauth / symfony-bundle
Symfony bundle for BetterAuth - Modern authentication library
Package info
github.com/MakFly/betterauth-symfony
Type:symfony-bundle
pkg:composer/betterauth/symfony-bundle
v0.0.18
2026-03-05 15:56 UTC
Requires
- php: ^8.4
- api-platform/core: ^4.0
- bacon/bacon-qr-code: ^2.0|^3.0
- doctrine/doctrine-bundle: ^2.0|^3.0
- doctrine/doctrine-migrations-bundle: ^4.0
- doctrine/orm: ^3.0
- monolog/monolog: ^3.0
- nelmio/cors-bundle: ^2.0
- paragonie/paseto: ^3.1
- psr/cache: ^3.0
- ramsey/uuid: ^4.7
- symfony/asset: ^6.4|^7.0|^8.0
- symfony/config: ^6.4|^7.0|^8.0
- symfony/console: ^6.4|^7.0|^8.0
- symfony/dependency-injection: ^6.4|^7.0|^8.0
- symfony/filesystem: ^6.4|^7.0|^8.0
- symfony/framework-bundle: ^6.4|^7.0|^8.0
- symfony/http-kernel: ^6.4|^7.0|^8.0
- symfony/mailer: ^6.4|^7.0|^8.0
- symfony/mime: ^6.4|^7.0|^8.0
- symfony/property-access: ^6.4|^7.0|^8.0
- symfony/property-info: ^6.4|^7.0|^8.0
- symfony/security-bundle: ^6.4|^7.0|^8.0
- symfony/serializer: ^6.4|^7.0|^8.0
- symfony/twig-bundle: ^6.4|^7.0|^8.0
- symfony/uid: ^6.4|^7.0|^8.0
- symfony/validator: ^6.4|^7.0|^8.0
- symfony/yaml: ^6.4|^7.0|^8.0
Requires (Dev)
- dg/bypass-finals: ^1.9
- doctrine/doctrine-fixtures-bundle: ^4.3
- liip/test-fixtures-bundle: ^3.8
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.5
- symfony/browser-kit: ^6.4|^7.0|^8.0
- symfony/debug-bundle: ^6.4|^7.0|^8.0
- symfony/http-client: ^6.4|^7.0|^8.0
- symfony/maker-bundle: ^1.0
- symfony/monolog-bundle: ^3.0
- symfony/phpunit-bridge: ^6.4|^7.0|^8.0
- symfony/stopwatch: ^6.4|^7.0|^8.0
- symfony/web-profiler-bundle: ^6.4|^7.0|^8.0
Suggests
- ext-apcu: APCu extension for in-memory caching (development)
- ext-redis: Redis extension for better performance
- geoip2/geoip2: For IP geolocation in device tracking
- mobiledetect/mobiledetectlib: For device detection in device tracking
- symfony/redis: For Redis-based rate limiting (recommended for production)
README
Modern authentication bundle for Symfony with API/session/hybrid modes, token rotation, OAuth, 2FA, and optional multi-tenant features.
TL;DR
composer require betterauth/symfony-bundle php bin/console better-auth:install php bin/console better-auth:setup-features --preset=full --with-controllers --migrate
Then check generated routes:
php bin/console debug:router | grep auth
Compatibility
- PHP:
^8.4 - Symfony:
^6.4 | ^7.0 | ^8.0 - API Platform:
^4.0 - Doctrine ORM:
^3.0 - Doctrine Migrations Bundle:
^4.0 - Databases tested in CI:
- PostgreSQL
- SQLite
- MySQL
- MariaDB
Database URLs
Use one of these DATABASE_URL values:
# PostgreSQL DATABASE_URL=postgresql://app:secret@127.0.0.1:5432/app?serverVersion=16&charset=utf8 # SQLite DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db # MySQL DATABASE_URL=mysql://app:secret@127.0.0.1:3306/app?serverVersion=8.4&charset=utf8mb4 # MariaDB DATABASE_URL=mysql://app:secret@127.0.0.1:3306/app?serverVersion=mariadb-11.0.2&charset=utf8mb4
Main Console Commands
better-auth:installbetter-auth:setup-featuresbetter-auth:add-controllerbetter-auth:user-fieldsbetter-auth:configurebetter-auth:switch-modebetter-auth:generate-configbetter-auth:generate-secretbetter-auth:setup:dependenciesbetter-auth:setup:loggingbetter-auth:config:updatebetter-auth:publish-templatesbetter-auth:cleanup:sessionsbetter-auth:cleanup:tokens
Documentation
Start here:
Most-used guides:
- API Mode
- Session Mode
- Hybrid Mode
- OAuth Providers
- Two-Factor Auth (TOTP)
- Security Guide
- Testing
- Migration Guide
- Entity Customization
- Controllers
- Advanced Customization
Security Note
This bundle uses Paseto V4 and supports hardening through configuration, rate limiting strategy, and security monitoring options. For production hardening checklist, see docs/11-SECURITY.md.
License
MIT. See LICENSE.