Download the PHP package netsells/hash-model-ids without Composer
On this page you can find all versions of the php package netsells/hash-model-ids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hash-model-ids
Hash Model Ids
Dynamically create a hash of an Eloquent model id value to avoid exposing a record's actual database id.
Features
Use the HashesModelIdsTrait
in an Eloquent model to enable the following functionality:
- Access a model's hashed id value:
$model->hashed_id
- Filter a model by an array of or a single hashed id:
Model::whereHashedId($hashedId)
Model::whereHashedIds($hashedIds)
-
Define routes with models bound by their hashed id:
- Check for model existence in form request classes using a bespoke rule, optionally including additional chained constraints:
Installation
Install the package with:
composer require netsells/hash-model-ids
Publish the package config file:
php artisan vendor:publish --tag=hash-model-ids-config
Optionally set a HASH_MODEL_IDS_SALT
in .env
.
Translations
Publish the package translations file:
php artisan vendor:publish --tag=hash-model-ids-lang
Development
Sometimes, during development, it can be awkward dealing with hashed ids. Set HASH_MODEL_IDS_ENABLED=false
in your environment file to enable use of a (configurable) prefixed version of a model's actual id rather than the default hashed version.
Testing
./vendor/bin/phpunit
All versions of hash-model-ids with dependencies
hashids/hashids Version ^5.0
illuminate/contracts Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/support Version ^10.0|^11.0
illuminate/validation Version ^10.0|^11.0