Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Hashids Laravel Package

swindon/filament-hashids

Integrates Hashids with Filament so resource URLs use short, unique hash strings instead of sequential numeric IDs. Hide database keys, keep admin links cleaner and harder to guess, and configure encoding without changing your underlying schema or models.

View on GitHub
Deep Wiki
Context7

Getting Started

This package lets a Filament panel route resources by Hashids instead of raw auto-increment IDs, so POST doesn't leak /admin/posts/42 to /admin/posts/jR4bYq9m. At v1.0.0 treat the API as stable but thin — read the source (src/) and the README first; there is no wiki or detailed changelog beyond the commit list.

Minimal setup:

  1. composer require swindon/filament-hashids
  2. Publish config if the package ships one: php artisan vendor:publish --tag="filament-hashids-config"
  3. Register the plugin in your panel provider (app/Providers/Filament/AdminPanelProvider.php):
public function panel(Panel $panel): Panel
{
    return $panel
        ->id('admin')
        ->path('admin')
        ->plugin(HashidsPlugin::make());
}

First use case: enable it on a single low-risk resource in staging, click through list → view → edit → delete, and confirm the URLs contain hashes while Filament's internal links, relation managers, and global search results still resolve. If those all work, roll it out panel-wide.

Implementation Patterns

  • Panel-scoped opt-in. Register the plugin only on the panel(s) that need it (e.g., an admin panel), not globally, so public-facing Filament bits keep normal IDs.
  • Config-driven salt and length. Keep salt in config/hashids.php (or the package config) sourced from env('HASHIDS_SALT'). Set a minimum length long enough to look non-sequential — 8–16 is typical — and keep it constant per environment.
  • Custom connections per model. If the package exposes Hashids connections (the underlying vinkla/hashids style), define separate salts for tenant-scoped or high-sensitivity resources so a leaked salt doesn't expose every model.
  • Route model binding is the integration point. Most likely the plugin hooks Model::resolveRouteBinding() / getRouteKey() or overrides Filament's record resolution. Verify it covers Route::resource bindings, Filament resource pages, and custom Route::get('/posts/{post}') if you mix them.
  • Generate URLs in Blade/Livewire with route('filament.admin.resources.posts.edit', ['record' => $post]) — let the binding do the hashing rather than calling Hashids::encode() manually, otherwise you'll drift from the package's configured connection.
  • Testing pattern. In Pest/PHPUnit, resolve records the same way the app does rather than hardcoding IDs in URL assertions; assert on ->assertSuccessful() and on the resolved model, not on the literal hash string.

Gotchas and Tips

  • This is obfuscation, not security. Hashids is reversible with the salt; treat IDs as still enumerable if the salt leaks. Use policies/authorization as the real gate — never rely on the hash to protect a record.
  • Changing salt invalidates every existing URL. Bookmarks, email links, and any stored edit_url in notifications will 404 after a salt change. Rotate deliberately, ideally with a redirect/fallback that resolves both old and new.
  • Length changes are one-way-safe. Increasing length is fine; decreasing below the encoded length can alter output and break stored links.
  • Hashids cannot encode 0 or negative integers. Filament resources backed by id = 0 (rare) or composite keys will misbehave. Confirm the package handles this or falls back gracefully.
  • Global search, relation managers, and action modals run through Livewire and may pass raw IDs in the payload — test these specifically, as they are the usual place a route-binding-only plugin leaks raw IDs.
  • Conflicts with other route-key packages (spatie/laravel-sluggable, calebporzio/sushi, custom getRouteKeyName) are common. Pick one strategy per model; don't stack.
  • Debugging: if a route 404s, log the value hitting resolveRouteBinding — an un-hashed ID or a double-hashed value (encoded twice via a manual encode() plus the plugin) is the usual culprit. Cache and config:cache can mask salt changes; clear both after touching HASHIDS_SALT.
  • Extension point: wrap the plugin behind a feature flag (config('filament-hashids.enabled')) so you can disable hashing per environment without redeploying routes, and keep a rollback path to raw IDs during the transition.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
muka/shape-reader
tdt/json
refinery29/php-cs-fixer-config
hotmeteor/eco-env
mvaliolahi/hydrate
wearede/tbcpay-php
parsnick/steak
thibaud-dauce/mattermost-php
multilinguals/apollo-client
antaresbr/collection
kr0lik/phpstan-rules
loco/loco
starfederation/datastar-php
yupmin/modern-phystrix
stephenjude/extended-artisan-commands
lumphp/laravel-macroable
lumphp/laravel-collections
lumphp/laravel-contracts
sermepa/sermepa
arkecosystem/fortify