Utilities

The bundle provides two utility classes:

PasswordStrengthChecker

This class has only one method: getStrength, and returns the strength of a given password (between 0 and 100, 100 being the best value).

If the second argument - $username is provided, the method will remove the username from the password if it contains it.

See also the PasswordStrength constraint.

Usage

use Leapt\CoreBundle\Util\PasswordStrengthChecker;

$passwordStrengthChecker = new PasswordStrengthChecker();
$score = $passwordStrengthChecker->getStrength($password, $username);

StringUtil

The StringUtil has 4 public & static methods, their names speak for themselves:

Usage

use Leapt\CoreBundle\Util\StringUtil;

$name = 'Café means coffee';

$withoutAccents = StringUtil::slugify($name); // Cafe means coffee
$slug = StringUtil::slugify($name); // cafe-means-coffee

Navigation Helper

Validator Constraints