- Can I install jasonbradley/hash-ids-bundle in a Laravel application?
- No. jasonbradley/hash-ids-bundle is a Symfony2 bundle, not a Laravel package: it ships a Bundle subclass and a DependencyInjection extension that Laravel's container does not consume. Installing it in Laravel leaves an inert vendor directory. Use hashids/hashids or sqids/sqids directly with a small Laravel service provider.
- What is jasonbradley/hash-ids-bundle used for?
- It wraps the Hashids library as a configurable Symfony service so you can encode numeric database IDs into short, reversible, non-sequential strings and decode them on input. It is intended for hiding auto-increment IDs in Symfony routes and APIs. It is not a security boundary.
- Which Laravel and PHP versions does jasonbradley/hash-ids-bundle support?
- None for modern Laravel. The bundle's release history ends in 2015 and targets Symfony 2.x-era PHP 5.3/5.4 constraints, with no PHP 7/8 or Laravel 10/11/12 support. Composer install will fail platform checks on PHP 8.1+ unless you use ignore-platform-reqs, which is not advisable for unmaintained code.
- How do I encode and decode IDs in Laravel without this Symfony bundle?
- Run composer require hashids/hashids or sqids/sqids as a direct dependency. Add config/hashids.php for salt, minimum length, and alphabet, bind a singleton encoder in a service provider, and inject a small PublicIdEncoder interface at call sites. Add an Eloquent accessor or cast for outbound public IDs and decode incoming route parameters before lookup.
- Is Hashids secure enough to hide database IDs?
- No. Hashids is reversible obfuscation, not encryption: anyone with the salt can decode and enumerate dense IDs, and salt leakage through a committed .env or stack trace is a common failure. If the requirement is unguessable IDs, use a random opaque token column with a unique index instead.
- How should I configure the salt and minimum hash length in Laravel?
- Publish a config/hashids.php file with salt, min_length, and alphabet values sourced from environment variables such as HASHIDS_SALT, HASHIDS_MIN_LENGTH, and HASHIDS_ALPHABET. Bind the encoder as a singleton in a service provider. Fail fast at boot if the salt is empty outside local environments. Decide explicitly whether one global salt or per-tenant salts fit your tenancy model.
- What happens to existing links if I rotate the Hashids salt?
- Previously generated hashes will no longer decode, so already-shared URLs and API links break. Treat link permanence as a product decision and, if needed, plan salt versioning or a fallback lookup map. Do not rotate the salt casually in production.
- Does jasonbradley/hash-ids-bundle provide Twig or Blade integration?
- The bundle advertises Symfony Twig integration, but Laravel uses Blade and does not consume Symfony Twig extensions. There is no Blade directive in this package. If you use the underlying library, add your own Blade directive or facade helper around the encoder.
- How should I test Hashids encoding and decoding in a Laravel app?
- Unit test your encoder service for encode/decode round trips, invalid input, and configured salt and minimum length. Add feature tests for routes that expose public IDs and for decode-on-input failure paths. Do not test the vendor library itself; test your Laravel integration, config validation, and Eloquent casting behavior.
- What are the best alternatives to jasonbradley/hash-ids-bundle for Laravel?
- Use hashids/hashids or sqids/sqids directly and wrap them in a Laravel service provider, config file, and Eloquent cast. If you need unguessable identifiers rather than cosmetic obfuscation, use UUIDs, ULIDs, or a random opaque token column. Avoid this Symfony bundle in Laravel because it adds Symfony HTTP kernel coupling without adding reusable Laravel integration.