We use cookies for commenting and analytics. Share on Facebook, Linkedin, TwitterWhen we are working with users or posts, one of the features that we often need is generating usernames or slugs.
Let’s see how can we use a very simple solution: generating incremental usernames.
With a very simple regex pattern, we can easily track the similar usernames in the database, and add, or increment a numeric suffix to the username.
However, when you need a more complex solution for slugs or usernames, you might extend this solution or pull in a package.