<commit_before>XUID Library
============

XUIDs are URL-friendly compressed UUIDs

## Why XUIDs?

A UUID v4 is a great choice as a primary key for your database tables.

But, they are quite long to use in URLs and databases : 32 alphanumeric characters and four hyphens

A XUID is a UUID, converted into a 128-bit value, converted into a base64 string, then converted into url-safe base64.

This gives you a 24 character string, safe to use in URLs.

It also safely decodes into a full UUID string again.

## Benefits

* Takes less space in database fields
* Shorter URLs
* Un-guessable primary keys in URLs

## Usage

```php

$xuid = new \Xuid\Xuid();

$in = $xuid->getUuid(); // ffe25f31-907e-46c0-b2f8-8bbfedb9082b

$tmp = $xuid->encode($in); // _-JfMZB-RsCy-Iu_7bkIKw

$out = $xuid->decode($tmp); // ffe25f31-907e-46c0-b2f8-8bbfedb9082b
```

## Brought to you by the LinkORB Engineering team

<img src="http://www.linkorb.com/d/meta/tier1/images/linkorbengineering-logo.png" width="200px" /><br />
Check out our other projects at [engineering.linkorb.com](http://engineering.linkorb.com).

Btw, we're hiring!<commit_msg>Update README about static calling<commit_after>XUID Library
============

XUIDs are URL-friendly compressed UUIDs

## Why XUIDs?

A UUID v4 is a great choice as a primary key for your database tables.

But, they are quite long to use in URLs and databases : 32 alphanumeric characters and four hyphens

A XUID is a UUID, converted into a 128-bit value, converted into a base64 string, then converted into url-safe base64.

This gives you a 24 character string, safe to use in URLs.

It also safely decodes into a full UUID string again.

## Benefits

* Takes less space in database fields
* Shorter URLs
* Un-guessable primary keys in URLs

## Usage

```php
use Xuid\Xuid;

$xuid = new Xuid();

$in = $xuid->getUuid(); // ffe25f31-907e-46c0-b2f8-8bbfedb9082b

$tmp = $xuid->encode($in); // _-JfMZB-RsCy-Iu_7bkIKw

$out = $xuid->decode($tmp); // ffe25f31-907e-46c0-b2f8-8bbfedb9082b

$tmp = $xuid->getXuid();

$newXuid = $xuid->getXuid();
if (!$xuid->isValidXuid($newXuid)) {
    // this Xuid is valid
}
```

All methods can be called statically as well:

```php
use Xuid\Xuid;

$x = Xuid::getXuid();
$u = Xuid::decode($x);
```

## PHPUnit tests

```
vendor/bin/phpunit test/
```

## Brought to you by the LinkORB Engineering team

<img src="http://www.linkorb.com/d/meta/tier1/images/linkorbengineering-logo.png" width="200px" /><br />
Check out our other projects at [engineering.linkorb.com](http://engineering.linkorb.com).

Btw, we're hiring!
{'fraction_non_alphanumeric': 0.1306884480746791, 'fraction_numerical': 0.039673278879813305, 'mean_word_length': 4.123505976095617, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2571789', 'n_tokens_mistral': 1014, 'n_tokens_neox': 927, 'n_words': 300}