How to programmatically create a user in Drupal 8

Make user account programmatically with PHP in Drupal 8

No more user_save() and such. What is a nerd to do?

Try the following code, and for those of you programmatically migrating users across from an old site, note that you can set the new user's ID to whatever you want! You don't have to let the system auto-assign the next-available number according to the database. And when you go back to creating users "the normal way" it will resume with the next number after the highest you've assigned. Pretty cool!


Subscribe to RSS - user_save