appkweb/uuid

Light lib to generate an universally unique identifier V4

Maintainers

Package info

github.com/appkweb/uuid

pkg:composer/appkweb/uuid

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

1.0.0 2024-09-10 23:22 UTC

This package is auto-updated.

Last update: 2026-03-11 02:33:58 UTC


README

Light lib to generate an universally unique identifier V4

Get started

  • composer install appkweb/uuid
  • public function __construct(
          private readonly UuidService $uuidService,
      )
      {
      }
    
      /**
       * @return void
       * @throws Exception
       */
      public function __invoke():void
      {
          echo "{$this->uuidService->generate()}\n";
      }
    

Sources of Entropy

  • Generates 16 random bytes with high entropy, which is excellent for value diversity.
  • Provides a timestamp in milliseconds, adding a time dimension.
  • Includes the process ID, which varies between processes but is stable during the execution of a specific process.
  • Generates an additional random number, adding even more diversity.
  • Generates a unique identifier based on the current time and a random number, used in the hash to add additional entropy.