Refine will be launching soon 🎉 Sign up for the early access list to stay up to date.
Refine for Laravel
A package by Hammerstone

Hybrid Stabilization

Hammerstone Refine has not launched yet. Sign up for the early access list to stay up to date!

There are a few drawbacks to both the Database Stabilizer and the UrlEncoded Stabilizer. If you choose to take advantage of automatic stabilization via the Database Stabilizer, you could end up storing a huge number of transient records, depending on your application's usage.

However, if you opt for solely the UrlEncoded Stabilizer, it's possible that some filters may serialize in such a way that they exceed the 2,000 character limit limit for URLs.

The Hybrid Stabilizer combines both the database and UrlEncoded methods into one, with each covering the shortcomings of the other.

When using the Hybrid Stabilizer, we'll first run the filter through the UrlEncoded Stabilizer, and if the resulting stable id is fewer than 1,500 characters we return the encoded string as the stable_id. This ensures that you are always safe to put the entire stable_id into the URL.

If, however, the UrlEncoded encoded string comes in at more than 1,500 characters, we will fall back to the Database Stabilizer. This means that only the complicated filters or filters with very long values will get stored in the database.

By using both stabilizers in conjunction we both

  • decrease the number of filters stored in the database
  • and ensure that stable_ids are always URL-safe.

To differentiate the resulting IDs from each other, a prefix is added to each id. Filters that were stabilized via UrlEncoded will be prefixed with UE, while the Database stabilized filters recieve DB.