Download the PHP package dekuan/dedid without Composer

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

dekuan/dedid

An unique id generator for primary key of distributed database. This implementation of the algorithm was referenced by Twitter Snowflake, but in the last 12 bits you can not only use the random numbers, but also get a hash value by your specified string.

ALGORITHM

Bit structure

It's a 64 bits bigint.

0 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx x xxxxx xxxxx xxxx xxxxxxxx

Details

Position Length Usage Remark
0 1 Reserved Always be 0
1~41 41 Escaped Time (in millisecond) 0~69 years
42~46 5 Number of data center 0~31
47~51 5 Number of data node in the data center 0~31
52~63 12 Random / Hash 0~4095

Bit marks

Center

0 00000000 00000000 00000000 00000000 00000000 0 11111 00000 0000 00000000

00000000 00000000 00000000 00000000 00000000 00111110 00000000 00000000

00       00       00       00       00       3E       00       00

Node

0 00000000 00000000 00000000 00000000 00000000 0 00000 11111 0000 00000000

00000000 00000000 00000000 00000000 00000000 00000001 11110000 00000000

00       00       00       00       00       01       F0       00

Escaped Time

0 11111111 11111111 11111111 11111111 11111111 1 00000 00000 0000 00000000

01111111 11111111 11111111 11111111 11111111 11000000 00000000 00000000

7F       FF       FF       FF       FF       C0       00       00

Random or Hash value

0 00000000 00000000 00000000 00000000 00000000 0 00000 00000 1111 11111111

00000000 00000000 00000000 00000000 00000000 00000000 00001111 11111111

00       00       00       00       00       00       0F       FF

HOW TO USE

Create an new id normally

$cDId       = CDId::getInstance();
$nCenter    = 0;
$nNode      = 1;

$arrD       = [];
$nNewId = $cDId->createId( $nCenter, $nNode, null, $arrD );

echo "new id = " . $nNewId . "\r\n";
print_r( $arrD );
output
new id = 114654484990270790
Array
(
    [center] => 0
    [node] => 1
    [time] => 27335759399
    [rand] => 3398
)

Create an new id with crc32 hash value by a specified string

$cDId       = CDId::getInstance();
$nCenter    = 0;
$nNode      = 15;

$sSrc       = "dekuan";
$arrD       = [];
$nNewId = $cDId->createId( $nCenter, $nNode, $sSrc, $arrD );

echo "new id = " . $nNewId . "\r\n";
print_r( $arrD );
output
new id = 114654631304370386
Array
(
    [center] => 0
    [node] => 1
    [time] => 27335794283
    [rand] => 2258
)

Parse an id for getting the details

$cDId       = CDId::getInstance();
$arrId      = $cDId->parseId( 114654631304370386 );
print_r( $arrId );
output
Array
(
    [center] => 0
    [node] => 1
    [time] => 27335794283
    [rand] => 2258
)

INSTALL

# composer require dekuan/dedid

For more information, please visit https://packagist.org/packages/dekuan/dedid


All versions of dedid with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
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 dekuan/dedid contains the following files

Loading the files please wait ....