Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
axlon committed Aug 25, 2020
0 parents commit f931e06
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
vendor/
composer.lock
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# zxcvbn-php-nl

- Plugin for [Zxcvbn-PHP](https://github.com/bjeavons/zxcvbn-php), containing Dutch dictionaries
- Dictionaries were pulled from [pepve/zxcvbn-nl](https://github.com/pepve/zxcvbn-nl)

Usage:
```php
$zxcvbn = new ZxcvbnPhp\Zxcvbn();
$zxcvbn->addMatcher(ZxcvbnPhp\Matchers\NL\DutchDictionaryMatch::class);
$zxcvbn->addMatcher(ZxcvbnPhp\Matchers\NL\DutchReverseDictionaryMatch::class);

...
$zxcvbn->passwordStrength('password');
```
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "23g/zxcvbn-php-nl",
"description": "Dutch translations for zxcvbn-php based on zxcvbn-nl",
"type": "library",
"license": "MIT",
"require": {
"php": "^7.4",
"bjeavons/zxcvbn-php": "^1.1"
},
"autoload": {
"psr-4": {
"ZxcvbnPhp\\Matchers\\NL\\": "src/"
}
}
}
1 change: 1 addition & 0 deletions resources/frequency_list.php

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/frequency_lists.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/DutchDictionaryMatch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace ZxcvbnPhp\Matchers\NL;

use ZxcvbnPhp\Matchers\DictionaryMatch;

class DutchDictionaryMatch extends DictionaryMatch
{
use DutchTranslations;
}
10 changes: 10 additions & 0 deletions src/DutchReverseDictionaryMatch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace ZxcvbnPhp\Matchers\NL;

use ZxcvbnPhp\Matchers\ReverseDictionaryMatch;

class DutchReverseDictionaryMatch extends ReverseDictionaryMatch
{
use DutchTranslations;
}
22 changes: 22 additions & 0 deletions src/DutchTranslations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace ZxcvbnPhp\Matchers\NL;

trait DutchTranslations
{
protected static array $dutchRankedDictionaries;

/**
* Get the Dutch ranked dictionaries.
*
* @return array
*/
public static function getRankedDictionaries(): array
{
if (!isset(self::$dutchRankedDictionaries)) {
self::$dutchRankedDictionaries = require __DIR__ . '/../resources/frequency_list.php';
}

return self::$dutchRankedDictionaries;
}
}

0 comments on commit f931e06

Please sign in to comment.