laravel-snowflake icon indicating copy to clipboard operation
laravel-snowflake copied to clipboard

Random sequence resolver

Open mikkpokk opened this issue 1 year ago • 2 comments

I want to point it out, current solution deppends on random sequence resolver, which is usually not the best option.

It works well when IDs are generated by 1 process, but there's no way to guarantee overlap of the IDs, when several different processes will generate the ID. That is the case when your application runs on webserver. Each request has their own unique information about the class constructor.

Consider using https://github.com/godruoyi/php-snowflake with https://github.com/kra8/laravel-snowflake instead to make it more maintainable and flexible.

I would say, currently it's not the best to use kra8/laravel-snowflake on high traffic web application.

mikkpokk avatar May 17 '24 10:05 mikkpokk

Thank you for pointing that out.I completely agree with you.

Unfortunately, I don't have the time to continue maintaining this package at the moment.

Personally, if php-snowflake implemented the HasSnowflakeId Trait, I would prefer to use that instead.

kra8 avatar May 17 '24 11:05 kra8

@kra8

Unfortunately, I don't have the time to continue maintaining this package at the moment.

I just published a new package that integrates quite well into Laravel and uses php-snowflake under the hood for safe sequence generation, feel free to check it out!

https://github.com/calebdw/laraflake

calebdw avatar Jul 19 '24 07:07 calebdw