lubos-h what are you trying to build ?
If you send invalid data, a validation error will be thrown with details.
If you want to validate data in the same manner in another app, you can copy the Laravel Validation rules for the user model.
Basically there's just one regex for usernames and one length requirement for passwords.