Download the PHP package qopiku/filament-sqids without Composer
On this page you can find all versions of the php package qopiku/filament-sqids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package filament-sqids
Filament Sqids
Filament Sqids is a Laravel package that automatically encodes and decodes model IDs using sqids/sqids. By replacing numerical IDs with obfuscated Sqids, this package not only improves the aesthetics of your URLs but also provides an extra layer of security.
Table of Contents
- Filament Sqids
- Table of Contents
- Features
- Installation
- Configuration
- Usage
- Using the Model Trait
- Blade Directive
- Setup the Middleware
- Via Panels
- Via Specific Resources
- Testing
- Contributing
- Licence
Features
- Automatic Sqids Encoding: Transform model IDs in your URLs (e.g.
/admin/users/1/editbecomes/admin/users/86Rf07xd4z/edit). - Automatic Sqids Decoding: Middleware decodes Sqids back to real IDs when processing requests.
- Model Trait (
HasSqids): Easily apply Sqids to any Filament model. - Filament Plugin (
SqidsPlugin): Seamlessly integrate with Filament panels via$panel->plugin(SqidsPlugin::make()). - Customisable Sqids Config: Configure custom minimum length and alphabet via
filament-sqids.php. - Blade Directive (
@sqids($model)): Helper directive for generating Sqids in your Blade templates. - Artisan Command (
install:sqids): Simplifies setup by publishing configuration files and verifying dependencies.
Installation
Install the package via Composer:
If you wish to customise the configuration, run the install command:
This command will publish the configuration file (config/filament-sqids.php) to your Laravel application.
Configuration
After installation, you can adjust your settings in the config/filament-sqids.php file. You may set:
- min_length: The minimum length for the generated Sqids.
- alphabet: The alphabet used to generate the Sqids.
Usage
Using the Model Trait
Simply include the HasSqids trait in your model to enable Sqids functionality:
You can then retrieve the Sqids for a model instance:
You can query by Sqids for a model:
Blade Directive
In your Blade templates, generate a Sqids easily with the provided directive:
This will output the encoded ID of the model.
Using the Plugin (Recommended)
The simplest way to enable Sqids in your Filament panel is to use the SqidsPlugin:
Setup the Middleware Manually
If you prefer not to use the plugin system, you can apply the middleware directly:
Via Panels
Include it in the panel's middleware stack:
Via Specific Resources
Apply the middleware to specific resources only:
Testing
The package includes a suite of tests to cover its key functionality:
- Feature Tests: Validate that URLs are correctly rewritten and that routes work as expected.
- Unit Tests: Ensure that the
SqidsManager, middleware, and helper functions behave correctly.
To run the tests, simply execute:
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests if you have suggestions or improvements.
Licence
This package is open-sourced software licensed under the MIT licence.
Enjoy building secure and aesthetically pleasing URLs with Filament Sqids!
All versions of filament-sqids with dependencies
filament/filament Version ^3.0|^4.0|^5.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
sqids/sqids Version ^0.1|^0.2|^0.3|^0.4|^0.5