Download the PHP package linkorb/xuid without Composer

On this page you can find all versions of the php package linkorb/xuid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package xuid

XUID Library

XUIDs are URL-friendly compressed UUIDs www.xuid.org

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 (36 characters total)

A XUID is a UUID, converted into a 128-bit value, converted into a base64 string (stripped from padding characters), then converted into url-safe base64 (replacing + and / into - and _ respectively - custom mappings available, see below for more info).

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

It also safely decodes into a full UUID string again.

Benefits

Usage

All methods can be called statically as well:

Example

You'll find example code in the example/ directory.

To generate 100 XUIDs, run the following command:

Example output:

Generatic alpha-numeric XUIDs only

- and _ are occassionally found in XUIDs. If you prefer alpha-numeric only XUIDs, simply call the following static method before generating your XUIDs:

This will keep generating XUIDs until one is found that only contains alphanumeric characters. That means that it could require two or more attempts before a valid XUID can be returned. In practice this does not add any noticable latency. But this is worth keeping in mind when generating XUIDs in bulk.

Custom character mappings

The default character mapping for XUIDs (url safe) is:

But you can apply any other mapping you want for any of the characters used in base64 encoding, by calling Xuid::map(). For example, you can create double-click safe XUIDs (the whole XUID is selectable simply by double clicking it), by mapping + and _ to selectable characters. For example:

Beware to only pass in URL safe characters if your use-case requires URL safe XUIDs.

PHPUnit tests

Brought to you by the LinkORB Engineering team


Check out our other projects at engineering.linkorb.com.

Btw, we're hiring!


All versions of xuid with dependencies

PHP Build Version
Package Version
Requires ramsey/uuid Version ^3.0||^4.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package linkorb/xuid contains the following files

Loading the files please wait ....