Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same result for different numbers #202

Closed
anstapol opened this issue Jun 26, 2024 · 5 comments
Closed

Same result for different numbers #202

anstapol opened this issue Jun 26, 2024 · 5 comments

Comments

@anstapol
Copy link

Hi there, I'm using the library on a Laravel project to generate a string counterpart of the model unique identifier (integer).

I successfully used it on one model but now having conflicts with another one as you can see on the screenshot.

Am I missing something?

Screenshot 2024-06-26 at 08 37 46

@vinkla
Copy link
Owner

vinkla commented Jun 26, 2024

K and k are different characters.

@vinkla vinkla closed this as completed Jun 26, 2024
@anstapol
Copy link
Author

omg, so stupid of me I'm sorry. Had it saving to the MySQL database which is not considering the casing for the unique constraint 🤦‍♂️

thank you @vinkla!

btw I've noticed that in the docs the recommended PHP library is https://github.com/sqids/sqids-php is that repo going to eventually replace this one?

@vinkla
Copy link
Owner

vinkla commented Jun 26, 2024

omg, so stupid of me I'm sorry. Had it saving to the MySQL database which is not considering the casing for the unique constraint 🤦‍♂️

Don't recommend saving the hashed IDs in the database.

btw I've noticed that in the docs the recommended PHP library is https://github.com/sqids/sqids-php is that repo going to eventually replace this one?

Sqids is a successor but Hashids isn't going anywhere.

@anstapol
Copy link
Author

Don't recommend saving the hashed IDs in the database.

why not?

@miquelfire
Copy link

HashIDs (And Sqids) are meant to hide the real number used for the PK. So the database will have a number ID (1, 40, 200, etc.), but the end user will see the results of encoding to HashIDs in the URL, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants