imliam / php-unique-gmail-address

A package to ensure that a Gmail address is unique
MIT License
68 stars 4 forks source link

Clarity on useage #7

Closed paulhennell closed 3 years ago

paulhennell commented 3 years ago

This is quite a neat package, but I'm not sure it's clear enough on actual usage.

My first read I thought the idea was you have to normalize on the address before saving to the database, but reading the code it seems you can have example+anything@gmail.com saved in the database, then compare that with the new input to check for a match.

It might be good to make this process clearer in the example, or spell out why people use the + syntax and why you shouldn't normalise it unless you really have to. As an end user I don't mind someone blocking me from signing up twice, but stripping out the suffix would make me pretty cross.

imliam commented 3 years ago

Thanks @paulhennell, absolutely agree that it should be clearer when to reach for certain things.

I've just updated the readme in f9795b0 to explain why to store the original email address and offered an alternative to the regex in storing a normalised address alongside the original in a 2nd column in the database. Do you think this is good enough or could the explanation go further?

paulhennell commented 3 years ago

That works for me - pretty clear warnings for bad practice, and the suggestion of the 2nd column gives a good alternative solution to avoid destructive altering of data. 👍

(The only question I'd have reading that, is what is the data on differences between the direct match vs the regex match? But that's more a potential blog post idea then content needed here!)