Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Masking DB table's row ID using a random string - what should I use?

Hello,

If I want to mask the DB table id from the users, what is the best way to do it?

Should it be a random string or UUID? If it's a random string - what length and type? (like numbers, capital/lower-case letters etc.)

My goal is to mask the fetching of the row, so instead of using:

DB::table('my_table')->where('id', 5)->first();

It should be something like:

DB::table('my_table')->where('id', <some_masked_string>)->first();

Thanks

0 likes
2 replies

Please or to participate in this conversation.