PHPackages                             mrfrkayvaz/privata - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. mrfrkayvaz/privata

ActiveLibrary[Security](/categories/security)

mrfrkayvaz/privata
==================

A Laravel package that provides tools for masking, anonymizing, and managing personal data to help with privacy compliance.

v1.0.0(4mo ago)029↓50%MITPHPPHP ^8.2

Since Sep 4Pushed 4mo agoCompare

[ Source](https://github.com/mrfrkayvaz/privata)[ Packagist](https://packagist.org/packages/mrfrkayvaz/privata)[ RSS](/packages/mrfrkayvaz-privata/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (7)Used By (0)

🛡️ Privata
==========

[](#️-privata)

[![Latest Version on Packagist](https://camo.githubusercontent.com/23ba7484695ce4607afed610f2715cd93e55d960fd4cf15dd530679ad79bbc0e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7266726b617976617a2f707269766174612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrfrkayvaz/privata)[![License](https://camo.githubusercontent.com/db16e239946ebb5a601cb9c0e8c14eb2f8fbae825892c8d8b8120aba9d5ed087/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d7266726b617976617a2f707269766174613f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrfrkayvaz/privata)[![Total Downloads](https://camo.githubusercontent.com/b30e5cf23bf81349659739bd8e22eb16fff4c763cf76319dbd1d65f9f39988f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7266726b617976617a2f707269766174613f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrfrkayvaz/privata)[![GitHub stars](https://camo.githubusercontent.com/82dffe253b05c7799d5de46fce14d9913d579eb9dc3b6790e4444e4b5ef35bbe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d7266726b617976617a2f707269766174613f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/82dffe253b05c7799d5de46fce14d9913d579eb9dc3b6790e4444e4b5ef35bbe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d7266726b617976617a2f707269766174613f7374796c653d666c61742d737175617265)

A comprehensive Laravel package that provides tools for masking, anonymizing, and managing personal data to help with privacy compliance. Privata offers automatic encryption, data masking, and secure storage capabilities for sensitive information.

Features
--------

[](#features)

- 🔐 **Automatic Encryption**: Seamlessly encrypt sensitive data using AES encryption
- 🎭 **Data Masking**: Built-in masking for emails, phones, names, and custom data types
- 🛡️ **Privacy Compliance**: Help meet GDPR, CCPA, and other privacy regulations
- 🔧 **Flexible Configuration**: Customizable encryption drivers and masking rules
- 📊 **Eloquent Integration**: Easy-to-use trait for Laravel models
- 🧪 **Well Tested**: Comprehensive test suite with Pest PHP

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require mrfrkayvaz/privata
```

### Laravel Auto-Discovery

[](#laravel-auto-discovery)

The package will automatically register itself with Laravel 5.5+.

### Manual Registration

[](#manual-registration)

If you're using an older version of Laravel, add the service provider to your `config/app.php`:

```
'providers' => [
    // ...
    Privata\PrivataServiceProvider::class,
],
```

And add the facade alias:

```
'aliases' => [
    // ...
    'Privata' => Privata\Facades\Privata::class,
],
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="Privata\PrivataServiceProvider" --tag="privata-config"
```

### Environment Variables

[](#environment-variables)

Add these variables to your `.env` file:

```
PRIVATA_ENCRYPTION_DRIVER=aes
PRIVATA_ENCRYPTION_KEY=your-32-character-secret-key-here
PRIVATA_ENCRYPTION_CIPHER=aes-256-cbc
```

### Generate Encryption Key

[](#generate-encryption-key)

You can generate a secure encryption key using:

```
php artisan tinker
>>> base64_encode(random_bytes(32))
```

Usage
-----

[](#usage)

### Basic Encryption/Decryption

[](#basic-encryptiondecryption)

```
use Privata\Facades\Privata;

// Encrypt data
$encrypted = Privata::encrypt('sensitive data');

// Decrypt data
$decrypted = Privata::decrypt($encrypted);
```

### Model Integration

[](#model-integration)

Use the `Encryptable` trait in your Eloquent models:

```
