PHP code example of henzeb / laravel-encrypted-data-rotator
1. Go to this page and download the library: Download henzeb/laravel-encrypted-data-rotator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
henzeb / laravel-encrypted-data-rotator example snippets
use Henzeb\Rotator\Attributes\EncryptsData;
#[EncryptsData]
public function myAttribute(): Attribute
{
return Attribute::set(
fn($value) => encrypt($value)
)->get(fn($value) => decrypt($value));
}
use Henzeb\Rotator\Contracts\CastsEncryptedAttributes;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
class YourCustomAttribute implements CastsAttributes, CastsEncryptedAttributes
{
// your implementation
}
bash
php artisan vendor:publish --tag=rotator
bash
php artisan key:rotate
bash
php artisan key:rotate --force
bash
php artisan key:rotate-data
bash
php artisan key:cleanup-previous-keys
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.