Git Product home page Git Product logo

uuid's Introduction

UUID

GitHub Workflow Status Codacy Badge Libraries.io dependency status for GitHub repo Packagist Downloads License: MIT Packagist Version Packagist PHP Version Support GitHub code size in bytes

UUID (v1, v3-v5) Generator (RFC4122)

Note: If your library uses PHP version 8 or higher it is recommended to use infocyph/UID instead.

Prerequisites

Language: PHP 7.1/+

Installation

composer require abmmhasan/uuid

Usage

v1

// Get v1 UUID (Time based)
\AbmmHasan\UUID\GenerateUuid::v1();

// Get generated node, for further use
$node = \AbmmHasan\UUID\GenerateUuid::getNode();

// Pass your pre-generated node (for node specific UUID)
\AbmmHasan\UUID\GenerateUuid::v1($node);

// alternatively can also use
\AbmmHasan\UUID\uuid1();

v3

// Get v3 UUID for 'TestString' (default X500 namespace)
\AbmmHasan\UUID\GenerateUuid::v3('TestString');

/**
* Get v3 UUID for an URL & pre-defined namespace
* You can pass X500, URL, OID, DNS (check RFC4122 #Appendix C)
*/
\AbmmHasan\UUID\GenerateUuid::v3('abmmhasan.github.io','url');

// You can generate a random UUID & use as namespace as well
\AbmmHasan\UUID\GenerateUuid::v3('abmmhasan.github.io','fa1700dd-828c-4d1b-8e6d-a6104807da90');

// alternatively can also use
\AbmmHasan\UUID\uuid3();

v4

// Get v4 UUID (completely random)
\AbmmHasan\UUID\GenerateUuid::v4();

// alternatively can also use
\AbmmHasan\UUID\uuid4();

v5

// Get v5 UUID for 'TestString' (default X500 namespace)
\AbmmHasan\UUID\GenerateUuid::v5('TestString');

/**
* Get v5 UUID for an URL & pre-defined namespace
* You can pass X500, URL, OID, DNS (check RFC4122 #Appendix C)
*/
\AbmmHasan\UUID\GenerateUuid::v5('abmmhasan.github.io','url');

// You can generate a random UUID & use as namespace as well
\AbmmHasan\UUID\GenerateUuid::v5('abmmhasan.github.io','fa1700dd-828c-4d1b-8e6d-a6104807da90');

// alternatively can also use
\AbmmHasan\UUID\uuid5();

v2

/** 
* Not supported! 
*/

Support

Having trouble? Create an issue!

uuid's People

Contributors

abmmhasan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.