PHPackages                             createnl/zxcvbn-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. createnl/zxcvbn-bundle

ActiveSymfony-bundle

createnl/zxcvbn-bundle
======================

zxcvbn-php symfony bundle

3.1.0(2y ago)525.0k↓37.3%4[1 PRs](https://github.com/createnl/zxcvbn-bundle/pulls)MITPHPPHP ^8.0

Since May 1Pushed 2y ago3 watchersCompare

[ Source](https://github.com/createnl/zxcvbn-bundle)[ Packagist](https://packagist.org/packages/createnl/zxcvbn-bundle)[ RSS](/packages/createnl-zxcvbn-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (5)Versions (12)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e96fe82b7a5f9e805d3007ccc81309e339b3694335d0e9f6a9724b8d6afa5f89/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6372656174656e6c2f7a786376626e2d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/createnl/zxcvbn-bundle/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/c6b49ae34df5751ca5bd76716b6f37e2487a8d678a210718dc0dbdf7af7fa424/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6372656174656e6c2f7a786376626e2d62756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/createnl/zxcvbn-bundle?branch=master)[![CI](https://github.com/createnl/zxcvbn-bundle/workflows/CI/badge.svg)](https://github.com/createnl/zxcvbn-bundle/actions?query=workflow%3ACI)[![Packagist](https://camo.githubusercontent.com/7509e61be1c0e69e0b015091f28b0b5c9ca0e141a7d9a76a173237733e914786/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6372656174656e6c2f7a786376626e2d62756e646c65)](https://packagist.org/packages/createnl/zxcvbn-bundle)

Zxcvbn Symfony Bundle
=====================

[](#zxcvbn-symfony-bundle)

A bundle to integrate [zxcvbn-php](https://github.com/bjeavons/zxcvbn-php) with your symfony app. Supports localization and custom matchers.

Installation
------------

[](#installation)

```
composer require createnl/zxcvbn-bundle
```

Basic Usage
-----------

[](#basic-usage)

```
use Createnl\ZxcvbnBundle\ZxcvbnFactoryInterface;

class PasswordController
{
    public function updatePassword(string $password, ZxcvbnFactoryInterface $zxcvbnFactory)
    {
        $userData = [
          'Marco',
          'marco@example.com'
        ];

        $zxcvbn = $zxcvbnFactory->createZxcvbn();

        $weak = $zxcvbn->passwordStrength($password, $userData);
        echo $weak['score']; // will print 0

        $strong = $zxcvbn->passwordStrength('correct horse battery staple');
        echo $strong['score']; // will print 4

        echo $weak['feedback']['warning']; // will print user-facing feedback on the password, set only when score
