saiashirwadinformatia / secure-ids
Secure your primary id often used in URL or shared in JSON
1.1
2021-10-24 06:01 UTC
Requires
- php: ^7.3|^7.4|^8.0
- illuminate/contracts: ^8.65
- illuminate/support: ^8.65
- vinkla/hashids: ^9.1
Requires (Dev)
- nunomaduro/collision: ^5.10
- orchestra/testbench: ^6.15
- pestphp/pest: ^1.18
- pestphp/pest-plugin-laravel: ^1.1
- vimeo/psalm: ^4.8
README
Installation
You can install the package via composer:
composer require saiashirwadinformatia/secure-ids
You can publish the config file with
php artisan vendor:publish --provider="SaiAshirwadInformatia\SecureIds\SecureIdsServiceProvider"
This is the contents of the published config file:
return [
'models_directory' => 'Models',
'model_namespace' => 'App\\Models\\',
'length' => 13,
];
Usage
Load the configs of SecureIds by calling in your AppServiceProvider boot
method
use SaiAshirwadInformatia\SecureIds\Facades\SecureIds;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
SecureIds::load();
}
Use trait HasSecureIds
for the models you want to enable securing the id.
use SaiAshirwadInformatia\SecureIds\Models\Traits\HasSecureIds;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
// Add below Trait to enable securing id's
use HasSecureIds;
// ...
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.