Download the PHP package nowo-tech/password-toggle-bundle without Composer
On this page you can find all versions of the php package nowo-tech/password-toggle-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nowo-tech/password-toggle-bundle
More information about nowo-tech/password-toggle-bundle
Files in nowo-tech/password-toggle-bundle
Package password-toggle-bundle
Short Description Symfony bundle providing a password form type with toggle visibility feature
License MIT
Homepage https://github.com/nowo-tech/PasswordToggleBundle
Informations about the package password-toggle-bundle
Password Toggle Bundle
⭐ Found this useful? Give it a star on GitHub! It helps us maintain and improve the project.
Symfony bundle providing a password form type with toggle visibility feature.
This bundle is FrankenPHP worker mode friendly.
Features
- ✅ Password form type with toggle visibility
- ✅ Customizable icons and labels
- ✅ Web Component
<nowo-password-toggle>— CSP-safe script (no inlineonclick); event delegation stays compatible with Live Components - ✅ Icons via
symfony/ux-icons+symfony/http-client(Flex recipe installs both; graceful fallback + log warning if missing) - ✅ Fully configurable CSS classes
- ✅ Works with Live Components
- ✅ Accessibility support (ARIA labels, keyboard navigation)
- ✅ Configuration validation with clear error messages
- ✅ Type validation for all options
- ✅ Can be disabled per field (renders simple password input)
- ✅ Symfony Flex recipe for automatic installation (ux-icons + http-client + icon assets from recipe 1.2.3+)
Installation
Then, register the bundle in your config/bundles.php:
Note: If you're using Symfony Flex, the bundle will be registered automatically and a default configuration file will be created at
config/packages/nowo_password_toggle.yaml.
Requirements
- PHP >= 8.2, < 8.6
- Symfony >= 7.0 || >= 8.0
- Symfony UX Icons
^2.0 || ^3.0and symfony/http-client (same Symfony major) — required for the default Twig template (ux_icon()). Listed ascomposer suggeston the bundle; Symfony Flex adds both via the recipe. Without Flex:
If those packages are missing, the toggle still works but icons are omitted; see docs/INSTALLATION.md.
- Bootstrap 5 (recommended for styling, but not required)
Configuration
When installed via Symfony Flex, a default configuration file is automatically created at config/packages/nowo_password_toggle.yaml. If you're not using Flex or the file wasn't created, you can create it manually.
You can configure default values for all password fields in config/packages/nowo_password_toggle.yaml:
These defaults will be used for all PasswordType instances unless overridden when using the form type directly.
Usage
Basic Usage
With Options
Available Options
All options can be configured globally in config/packages/nowo_password_toggle.yaml or overridden per field when using the form type.
Note: All options are validated for correct types. Invalid values will throw exceptions with clear error messages.
| Option | Type | Default | Description |
|---|---|---|---|
toggle |
bool |
true |
Enable/disable toggle functionality. When false, renders a simple password input without toggle button |
visible_icon |
string |
'tabler:eye-off' |
Icon when password is hidden (must be non-empty) |
hidden_icon |
string |
'tabler:eye' |
Icon when password is visible (must be non-empty) |
visible_label |
string |
'Show' |
Label when password is hidden (must be non-empty) |
hidden_label |
string |
'Hide' |
Label when password is visible (must be non-empty) |
button_classes |
array |
['input-group-text', 'cursor-pointer'] |
CSS classes for toggle button (must be an array) |
toggle_container_classes |
array |
['form-password-toggle'] |
CSS classes for container (must be an array) |
use_toggle_form_theme |
bool |
true |
Use the bundle's form theme for rendering |
always_empty |
bool |
true |
Always render empty value |
trim |
bool |
false |
Trim whitespace |
invalid_message |
string |
'The password is invalid.' |
Invalid message (must be non-empty) |
Disabling Toggle
You can disable the toggle functionality for a specific field:
When toggle is false, the field renders as a standard password input without the toggle button, making it compatible with any styling or JavaScript framework.
Styling
The bundle includes CSS/SCSS styles for the toggle button. You can use them by:
Option 1: Include the CSS file
Option 2: Use the SCSS file
If you're using a build system (Webpack Encore, Vite, etc.), import the SCSS:
Option 3: Custom styles
The bundle uses these CSS classes that you can style:
.input-group.input-group-merge- Container.input-group-text.cursor-pointer- Toggle button.icon-base- Icon classes.icon-hidden/.icon-visible- Eye icons (.icon-visibleis hidden by default intoggle_password.css).is-password-visible- Added to the toggle button when the password is shown (CSP-safe; do not use inlinestyle.display)
Example custom styles:
Demo Projects
The bundle includes three demo projects demonstrating usage with different Symfony and PHP versions:
- Symfony 7.0 Demo (PHP 8.2) - Port 8001 (default, configurable via
.env) - Symfony 8.0 Demo (PHP 8.4) - Port 8001 (default, configurable via
.env) - Symfony 8.0 Demo with PHP 8.5 - Port 8001 (default, configurable via
.env)
Each demo is independent and includes:
- Complete Docker setup with FrankenPHP (HTTP on port 80). With
APP_ENV=dev(default), the image entrypoint usesCaddyfile.dev(no FrankenPHP worker, comfortable local dev). FrankenPHP worker mode is supported and tested in production demo configuration; see docs/DEMO-FRANKENPHP.md. - Comprehensive test suite
- Port configuration via
.envfile - Symfony Web Profiler for debugging (dev and test environments)
- Properly configured routing with attribute-based routes
- Bundle configuration file (
config/packages/nowo_password_toggle.yaml) demonstrating global configuration (v1.2.0+)
Quick Start with Docker
Or start any other demo:
See demo/README.md for detailed instructions for all demos.
Development
Using Docker (Recommended)
Without Docker
Code Quality
The bundle uses PHP-CS-Fixer to enforce code style (PSR-12).
CI/CD
The bundle uses GitHub Actions for continuous integration:
- Tests: Runs on PHP 8.2, 8.3, 8.4, and 8.5 with Symfony 7.0, 7.4, 8.0, and 8.1
- PHP 8.2 and 8.3: Symfony 7.0 and 7.4 (Symfony 8.0+ requires PHP 8.4+)
- PHP 8.4 and 8.5: All supported Symfony versions (7.0, 7.4, 8.0, 8.1)
- Code Style: Automatically fixes code style on push to main/master
- Code Style Check: Validates code style on pull requests
- Coverage: Validates ≥95% code coverage (see
MIN_COVERAGEin CI) - Dependabot: Automatically updates dependencies
See .github/workflows/ci.yml for details.
Documentation
- GitHub Actions CI requirements
- Installation
- Configuration
- PSR evaluation (REQ-CS-007)
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
- Demo with FrankenPHP (development and production)
- Overriding bundle templates
- Branching
Testing
The bundle targets ≥95% code coverage (CI minimum); current suite is at 100%. All tests are located in the tests/ directory.
Running Tests
Test Structure
tests/Unit/- Unit tests (bundle class, dependency injection, form type)tests/Integration/- Integration tests (reserved for integration scenarios)
All classes and methods are fully tested with 100% code coverage.
Tests and coverage
- Tests: PHPUnit (PHP)
- PHP: 89.51%
License
The MIT License (MIT). Please see LICENSE for more information.
Contributing
Please see docs/CONTRIBUTING.md for details on how to contribute to this project.
For information about branching strategy and versioning, see docs/BRANCHING.md.
Author
Created by Héctor Franco Aceituno at Nowo.tech
All versions of password-toggle-bundle with dependencies
symfony/form Version ^7.0 || ^8.0
symfony/framework-bundle Version ^7.0 || ^8.0
symfony/twig-bundle Version ^7.0 || ^8.0
twig/extra-bundle Version ^3.12
twig/string-extra Version ^3.12