Re: Proposal for a UUID package

From: Date: Sat, 06 Nov 2010 17:26:04 +0000
Subject: Re: Proposal for a UUID package
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-53883@lists.php.net to get a copy of this message
On Wed, Nov 3, 2010 at 2:25 PM, Michael Gauthier <mike@silverorange.com> wrote: > Hi Mathieu, Hi > There's no harm in starting a proposal. I, for one, think it's a good > idea and would make a good PEAR package. This sounds like a good > proposal for PEAR. I just asked to know if there were was some other way that I didn't know for generating them. I will continue to make it and make the formal proposal when it will be what I expect it to be. > The interface and features you describe sound great! Thanks. I've done them thinking about extensibility. > If you're looking for guidance on how to implement multiple backends, I > advise you to look at the HTTP_Request2 package. The way HTTP_Request2 > works, it uses a default adapter class and you can set any other adapter > class if you need to. This design works great for testing. I was more thinking about having multiple generators and pick one at runtime. Generators define some capacities: telling the parameters they accept/require (a name, a size, ...) and some "tags" they have (following RFC4122, creating unguessable UUIDs, being name-based, ...). The client calling the factory would define requirements (an array of parameters, tags required) and the factory would pick one corresponding generator and return the UUID. I would like to do that to allow different types to be generated: if they are to be used for session identifiers you need to make them really unguessable, if you want to insert them in a database you must specify the length, if you want interoperability you use RFC4122 ones. I still need to think about the exact interfaces in order to allow consistent extension (all name based should use the same parameter for example). > Nope, dependence on PECL libraries is allowed for PEAR packages. Actually it is not a real dependence but rather "used if present, fallback otherwise" > I think > there is also a PEAR package that will use an appropriate bigint library > depending on what the user has installed: > http://pear.php.net/package/Math_BigInteger I figured that out and used that library, sounds better than using a specific solution. > If you need help with the PEAR coding standards, try using the phpcs > tool to validate your code. > (http://pear.php.net/package/PHP_CodeSniffer/) If you need help with > setting up package.xml or your directory structure, many will be glad to > help out during the proposal phase. The code I made up to now is compliant with phpcs, except for one regular expression larger than 85 chars in one PHPUnit test. I didn't look at the package.xml file yet. Current code is on github, https://github.com/mathbruyen/uuid but does not include much. > Cheers! > Mike Mathieu

« previous php.pear.dev (#53883) next »