1

I need to generate an api key which should be unique and should never conflict. I think if I combine some stuff with unix timestamp then it would be possible. If someone can tell me more specific in php would be appreciable.

jeetu
  • 81
  • 1
  • 8
  • This answer may help you: http://stackoverflow.com/questions/2040240/php-function-to-generate-v4-uuid – Chris Jun 20 '13 at 11:33
  • Universally Unique Identifier. Globally Unique Identifier. Both known as UUID or GUID, that should produce sufficient googling material. A simple function exists, called `uniqid()` in PHP. MySQL has UUID() function that does the similar. – N.B. Jun 20 '13 at 11:34

2 Answers2

0

Just use UUID. There are some nice implementations in Packagist

JimiDini
  • 2,039
  • 12
  • 19
0

You can use http://php.net/manual/en/function.uniqid.php to generate uniq IDs as a starting point. and then combine them with extra salts that you build yourself to give you the assurance that the ID is valid and not easily faked by someone else.

Ahmed Masud
  • 21,655
  • 3
  • 33
  • 58