Feature Request #2750

Add GUID support

Added by Cédric Cazette about 2 years ago. Updated 4 months ago.

Status:Closed Start date:03/26/2010
Priority:Normal Due date:
Assignee:Woody Gilk % Done:

0%

Category:Core
Target version:-
Resolution:wontfix Points:

Description

I think it'd be great to have GUID generation support, as per RFC4122
http://www.ietf.org/rfc/rfc4122.txt

GUID proves to be useful in many situation (it is supported by most databases).

See one implementation there :
http://jasonfarrell.com/misc/guid.phps

Could be a great addition to Kohana_Num for instance.

History

Updated by Rick Jolly about 2 years ago

Would php's uniqid() suffice?

Updated by Cédric Cazette about 2 years ago

It is not the same really. Uniqid() is not RFC4122 compliant, it is just a "unique" string based on current time.
If you use it multiple times, you will get very similar output strings and everyone who is familiar with uniqid() will recognize the source algorithm. Further more, GUID is used extensively in RSS, syndication protocols and open protocols of all kind. It is also useful to generate token keys.
http://en.wikipedia.org/wiki/UUID

Though, there are multiples implementations of UUID (same as GUID) in the comments of PHP.net page
http://php.net/manual/en/function.uniqid.php

The implementation above is generating Version 4 UUID (random numbers), but implementing version 5 (based on namespace and name hashed with sha1) could be useful as well. There are also some v4 cryptographically secure implementations, this one in particular being interesting :
http://www.php.net/manual/en/function.uniqid.php#88400

Updated by Woody Gilk about 2 years ago

  • Category set to Core
  • Target version set to v3.1.0

Updated by Michiel Eghuizen about 2 years ago

I've added a helper class to a custom Kohana module for this one. I'm using UUID all over the place in my database. It's using the PECL UUID module, when available and it will fall back to the cryptographically secure implementation, mentioned by Cédric. The PECL UUID is a lot faster, so you will get a major advantage when installed.

See here for the source: http://pastie.org/915501

Updated by Igor Wiedler about 2 years ago

There's quite a decent PHP implementation here: http://www.shapeshifter.se/2008/09/29/uuid-generator-for-php/

Updated by Jeremy Bush over 1 year ago

  • Target version changed from v3.1.0 to v3.2.0

Updated by Jeremy Bush 12 months ago

  • Target version changed from v3.2.0 to v3.3.0

Updated by Jeremy Bush 5 months ago

  • Target version changed from v3.3.0 to Unscheduled

Updated by Woody Gilk 4 months ago

  • Status changed from New to Closed
  • Assignee set to Woody Gilk
  • Target version deleted (Unscheduled)
  • Resolution set to wontfix

I created a UUID module a while ago. This doesn't need to be added to Kohana core.

Also available in: Atom PDF