luilliarcec/laravel-username-generator
Laravel Username Generator creates unique, customizable usernames for Laravel apps from names, emails, or custom strings. It handles collisions, supports configurable patterns and validation, and integrates easily with Eloquent models and registration flows.
HasUsername trait auto-generates a username whenever a model is created, so product can ship signup flows without building bespoke handle-generation logic.creating model-event wiring in-house.creating event, usernames are populated for every new record, including seeded/factory-created data — useful for demos, staging, and analytics where handles are expected to exist.username at creation. That is a product constraint, not just an implementation detail: if the roadmap includes user-chosen handles at signup, or importing users with existing usernames, this trait’s contract will need to be worked around or replaced.Adopt when:
username generated automatically at creation time.username is regenerated on every creating event, and any value assigned beforehand is replaced.Look elsewhere / avoid when:
For executives: This is a small, low-blast-radius dependency that handles automatic username creation for new user records. The 6.0.1 release is a bug-fix patch: version 6.0.0 accidentally changed how usernames are generated and broke the package’s tests; 6.0.1 restores the documented, long-standing behavior. There is no new feature, no new cost, and no migration work. Recommendation: take the patch if we’re already on 6.0.0; otherwise no action required.
For engineering: Upgrade from 6.0.0 to 6.0.1 — the release is explicitly recommended by the maintainer. The HasUsername trait again unconditionally regenerates username on the creating event, honoring the package’s historical contract. The 6.0.0 blank() guard, which preserved a pre-existing username, has been removed; it broke the test suite (factories preassign username) and could leave usernames ungenerated when the attribute was already set. Verify our factories and any code paths that assign a username before save — those values will be overwritten on create by design. Full test run on bump.
How can I help you explore Laravel packages today?