Download the PHP package joby/smol-uid without Composer

On this page you can find all versions of the php package joby/smol-uid. 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 smol-uid

smolUID

A simple and lightweight time-ordered random ID library designed for human-scale applications.

What is smolUID?

smolUID is a simple, lightweight library for generating unique, time-ordered, human-readable IDs. Unlike full UUIDs, more complex enterprise-grade time-ordered IDs, or simple auto-incrementing database IDs, UIDs are:

Why smolUID?

Not every project needs guaranteed globally unique IDs or distributed systems. For many smaller applications, simpler solutions are often better:

Installation

Basic Usage

Creating a new UID

UID versions

Version Time resolution Random bits String length Availability
0 N/A (no time data) 58 13 ~288 quadrillion
1.0 1 second 11 10 ~1.4 billion/day
1.1 ~4.25 minutes 19 10 ~1.4 billion/day
1.2 ~18 hours 27 10 ~1.4 billion/day
1.3 ~3 days 29 10 ~1.4 billion/day
1.4 ~12 days 31 10 ~1.4 billion/day

Getting the string representation

Getting the underlying integer

Checking equality

Advanced Usage

Getting the underlying parts

Using with databases

UIDs can be stored in your database as either strings or integers:

Deterministic generation

UIDs can also be generated deterministically if you want to use them in a manner similar to a hash. In this case they are produced as version 0 UIDs with no time data, and their random data is produced by truncating a sha256 hmac or simple hash of the provided string.

Garbage collection

In long-running scripts that work with large numbers of different UIDs in a single run (think at least hundreds of thousands, if not millions), you may want to garbage-collect the internal cache periodically. This will clear out weak cache references to objects that have been garbage-collected by PHP.

Running garbage collection just takes running UID::garbageCollect()

How It Works

Each UID consists of a single integer value with three parts:

  1. 4-bit version identifier in the least significant bits, from which the other two parts' lengths are determined
  2. 0 or more bits of random data
  3. 0 or more bits of time data in the most significant bits, with varying amounts of precision dropped by truncating least significant bits of the current time

The combination is encoded in base-36 (alphanumeric) when a string representation is required, but can also be stored as an integer. All current versions are at most 63 bits long, allowing them to fit in a normal 64-bit signed integer. This means you can work with their underlying values easily and efficiently in almost any environment, with no special handling.

Future versions may expand to larger bit sizes, but for now the goal is to fit in a single signed integer for maximum compatibility and simplicity.

Limitations


All versions of smol-uid with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 joby/smol-uid contains the following files

Loading the files please wait ...