increment_max_attempts
config option to avoid an infinite loop should increment make unique method get used.isUnique
method toBaseDriver
- FindSimilarUsernames now provides a public
getUsernameColumnName
method. - The
makeUnique
algorithm- Rather than simply counting the total number of similar usernames and adding 1 to it, we'll now handle it in stages - this would cause problems see #63.
- Now we perform a check to see if the original algorithm works, then return if so.
- If not, we use the list of similar usernames and get the one with the highest value, and add 1 to it, if unique, return it.
- If not, we start at 0 and increment and check every value until we either get a unique one, or exhaust the
increment_max_attempts
- FindSimilarUsernames
getColumn
method in favour ofgetUsernameColumnName
(this likely affects no one unless you're specifically overriding that trait.)
- FindSimilarUsernames no longer needs a
usernameColumn
property in the parent model if the column is different than'username'
and the config file is not directly changed.
- Missing types for some properties.
- Driver and HandlesConfig contracts.
- getDriver() method in Generator class.
- Possible SQL injection vulnerability, see #54
- Bug where
findSimilarUsernames
would return an incorrect number of similarities when using the REGEXP function with a separator.
prefer_regexp
config option by default is nowfalse
- Added support for PHP 8.1
- Set minimum PHP version to 7.4
- Added first and last hook for custom drivers
- Generator now supports multibyte characters (Cyrillic, etc.)
- Added options for converting to ascii and validating the input string
- Text will automatically be converted to ASCII by default
- Moved the EmailDriver hook to first
- Convert case now happens second rather than first
- Fixes issue where custom dictionary nouns and adjectives were not being used
- Added maximum length check.
- Added ability for pre-filled usernames to go through generate process to allow for consistent username styles.
- Added checking for similar usernames using REGEXP or LIKE (LIKE is a fallback if REGEXP fails).
- Added a check if a username is unique as is before checking for similar ones.
- Updated
composer.json
to support PHP 7.2 and above - Updated readme for better Laravel 8+ quickstart
- Changed default User model from
App\User
toApp\Models\User
to mirror new Laravel versions (8.0+). - Moved the adjective and noun word lists from the config file to a separate file, making the published config smaller and allowing you to create your own word lists if you wish.
- Fixed bug where a model using the GeneratesUsernames without the specified column would throw an error rather than return a random username. See#25
- Bug fix that was preventing username generation on unique usernames, using the FindSimilarUsernames trait when the username had found nothing similar. See#23
- Providing an empty string to the generator now randomly generates a random username from a list of a nouns and adjectives.
- Fixed bug where setting a custom column in the model it wouldn't be respected. See #16
- Fixed support for overriding the
getName
method fromGeneratesUsernames
- Added support for more PHP versions.
- Added support for minimum length check.
- Switch to driver based conversion rather than name.
- Support for email conversion through drivers.
- Support for
makeUsername
method
Generator
will now only accept an array of config as the optional constructing arguments
UsernameGenerator
facade
- Issue where separators were added when trimming extra characters.
- Fixes assignment error bug.
- Bug fix for getting attributes in Laravel 5.7
makeUsername
method. Will be removed in v2Generator
constructor accepting a name
Generator
constructor accepts a name and config, name is deprecated.
generate
method to replacemakeUsername
GeneratesUsernames
traitgenerateFor
method
- Support for Laravel 5.6
- Readme