Download the PHP package godruoyi/php-snowflake without Composer

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

An ID Generator for PHP based on Snowflake Algorithm (Twitter announced).

build passed License Packagist Version Total Downloads

Description

Snowflake & Sonyflake algorithm PHP implementation 中文文档.

file

Snowflake is a network service that generates unique ID numbers at high scale with simple guarantees.

  1. The first bit is an unused sign bit.
  2. The second part consists of a 41-bit timestamp (in milliseconds) representing the offset of the current time relative to a certain reference time.
  3. The third and fourth parts are represented by 5 bits each, indicating the data centerID and workerID. The maximum value for both is 31 (2^5 -1).
  4. The last part consists of 12 bits, which represents the length of the serial number generated per millisecond per working node. A maximum of 4095 IDs can be generated in the same millisecond (2^12 -1).

If you want to generate unique IDs using the snowflake algorithm, you must ensure that sequence numbers generated within the same millisecond on the same node are unique. Based on this requirement, we have created this package which integrates multiple sequence number providers.

Requirement

  1. PHP >= 8.1
  2. Composer

Installation

Usage

  1. simple to use.

  2. Specify the data center ID and machine ID.

  3. Specify start time.

The maximum value of a 41-bit timestamp (in milliseconds) can represent up to 69 years, so the Snowflake algorithm can run safely for 69 years. In order to make the most of it, we recommend setting a start time.

  1. Use Sonyflake

Advanced

  1. Used in Laravel.

Since the SDK is quite straightforward, we do not offer a specific extension for Laravel. However, you can easily integrate it into your Laravel project by following these steps.

  1. Custom

To customize the sequence number resolver, you need to implement the Godruoyi\Snowflake\SequenceResolver interface.

And you also can use the Closure:

License

MIT


All versions of php-snowflake with dependencies

PHP Build Version
Package Version
Requires php-64bit 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 godruoyi/php-snowflake contains the following files

Loading the files please wait ....