Download the PHP package guava/sqids-for-laravel without Composer
On this page you can find all versions of the php package guava/sqids-for-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download guava/sqids-for-laravel
More information about guava/sqids-for-laravel
Files in guava/sqids-for-laravel
Package sqids-for-laravel
Short Description This is a laravel wrapper for sqids.
License MIT
Homepage https://github.com/GuavaCZ/sqids-for-laravel
Informations about the package sqids-for-laravel
Laravel wrapper for Sqids
Laravel Wrapper for sqids.org PHP library.
Support us
Your support is key to the continual advancement of our plugin. We appreciate every user who has contributed to our journey so far.
While our plugin is available for all to use, if you are utilizing it for commercial purposes and believe it adds significant value to your business, we kindly ask you to consider supporting us through GitHub Sponsors. This sponsorship will assist us in continuous development and maintenance to keep our plugin robust and up-to-date. Any amount you contribute will greatly help towards reaching our goals. Join us in making this plugin even better and driving further innovation.
Installation
You can install the package via composer:
Usage
This package adds a slightly modified version of the Sqids class, which allows a fluent configuration of all options. It also adds a salting option.
Generating Sqids
There's multiple ways you can use this package to generate sqids:
It's entirely up to you which way you prefer. In our examples, we will make use of the factory method.
Using in Eloquent Models
This package also comes with a trait that you can use in your Eloquent models. This trait will automatically add a sqid attribute which will be created from the model's primary key.
That's it! Now you can access the
sqid` attribute on your model.
You can custimize how the sqid on your model is generated by overriding the getSqids
method:
Route binding
If you want to be able to use the sqid
as the route key, simply add the HasSqidsRouting
trait to your model:
Options
Customizing the alphabet
Customizing the minLength
Customizing the block list
Salting
Salting can be used to generate different IDs based on the provided salt, which can be any string or integer.
Salting is especially useful when used on Models with the HasSqids
trait and you want every model to return different, unique IDs.
So for example a record of Model1
with the ID 1 has a different sqid that a record of Model2
with the ID 1.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Lukas Frey
- All Contributors
- Spatie - Our package skeleton is a modified version of Spatie's Package Skeleton
- https://github.com/mtvs/eloquent-hashids
License
The MIT License (MIT). Please see License File for more information.
All versions of sqids-for-laravel with dependencies
illuminate/contracts Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.0
sqids/sqids Version ^0.4.1