This guide covers installing Password Toggle Bundle in a Symfony application.
- PHP >= 8.1, < 8.6
- Symfony ^6.0 || ^7.0 || ^8.0
- symfony/form, symfony/framework-bundle, symfony/twig-bundle
- symfony/ux-icons ^2.0 || ^3.0 — required for the default Twig widget (
ux_icon()). The bundle onlysuggests it; runcomposer require symfony/ux-iconsunless you override the form theme to avoidux_icon().
composer require nowo-tech/password-toggle-bundleUse a constraint such as ^1.0 to stay on the current major version.
If you use Symfony Flex, the bundle is registered automatically and a default configuration file is created at config/packages/nowo_password_toggle.yaml.
- Register the bundle in
config/bundles.php:
<?php
return [
// ...
Nowo\PasswordToggleBundle\NowoPasswordToggleBundle::class => ['all' => true],
];-
Add the form theme so the password toggle widget is used. In
config/packages/twig.yamladd the bundle's widget toform_themes:twig: form_themes: - '@NowoPasswordToggleBundle/Form/toggle_password_widget.html.twig'
You can override this template in your app by placing a copy in
templates/bundles/NowoPasswordToggleBundle/Form/toggle_password_widget.html.twig. See USAGE.md. -
Create configuration (optional). Create
config/packages/nowo_password_toggle.yamlwith your preferred defaults. See CONFIGURATION.md for all options.