All Projects → ionghitun → laravel-lumen-mysql-encryption

ionghitun / laravel-lumen-mysql-encryption

Licence: MIT license
Database fields encryption in laravel and lumen for mysql databases with native search.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-lumen-mysql-encryption

Laravel Log Viewer
🐪 Laravel log viewer
Stars: ✭ 2,726 (+13530%)
Mutual labels:  lumen
lumen-session-example
Enable session in lumen framework (Laravel)
Stars: ✭ 22 (+10%)
Mutual labels:  lumen
nippo
本アプリケーションはYAPC::Hokkaido 2016の「Vue.jsによるWebアプリケーション開発」用に実装したサンプルアプリケーションです。
Stars: ✭ 17 (-15%)
Mutual labels:  lumen
laravel-redis-sentinel-drivers
Redis Sentinel integration for Laravel and Lumen.
Stars: ✭ 100 (+400%)
Mutual labels:  lumen
benotes
An open source self hosted notes and bookmarks taking web app.
Stars: ✭ 260 (+1200%)
Mutual labels:  lumen
lumen-realworld-example-app
Exemplary real world backend API built with Lumen + MongoDB
Stars: ✭ 50 (+150%)
Mutual labels:  lumen
Docker Lumen
Docker Compose setup for quickly writing apps with the Lumen Framework
Stars: ✭ 211 (+955%)
Mutual labels:  lumen
Lumen-Doctrine-DDD-Example
Domain Driven Design Application Example, built with Lumen 5.3 and Doctrine.
Stars: ✭ 72 (+260%)
Mutual labels:  lumen
Laravel-FluentLogger
fluent logger for laravel (with Monolog handler for Fluentd)
Stars: ✭ 55 (+175%)
Mutual labels:  lumen
deid
best effort anonymization for medical images using python
Stars: ✭ 108 (+440%)
Mutual labels:  anonymize
paper-wallet
stellar.github.io/paper-wallet/
Stars: ✭ 41 (+105%)
Mutual labels:  lumen
cache
Laravel & Lumen Cache Service | File and Redis cache system
Stars: ✭ 19 (-5%)
Mutual labels:  lumen
entrust
This package is based on Zizaco/entrust to support Laravel/Lumen 6+ versions
Stars: ✭ 22 (+10%)
Mutual labels:  lumen
qiniu-laravel-storage
Qiniu 云储存 Laravel 5 Storage版
Stars: ✭ 520 (+2500%)
Mutual labels:  lumen
inspector-laravel
Connect your Laravel application to Inspector.
Stars: ✭ 164 (+720%)
Mutual labels:  lumen
Lumen
An alternative BEAM implementation, designed for WebAssembly
Stars: ✭ 2,742 (+13610%)
Mutual labels:  lumen
fluent-plugin-anonymizer
Fluentd filter output plugin to anonymize records with MD5/SHA1/SHA256/SHA384/SHA512 algorithms. This data masking plugin protects privacy data such as ID, email, phone number, IPv4/IPv6 address and so on.
Stars: ✭ 52 (+160%)
Mutual labels:  anonymize
php-framework-benchmark
php framework benchmark (include laravel、symfony、silex、lumen、slim、yii2、tastphp etc)
Stars: ✭ 17 (-15%)
Mutual labels:  lumen
lumen-newrelic
New Relic instrumentation for the Lumen framework
Stars: ✭ 26 (+30%)
Mutual labels:  lumen
laravel-snowflake
This Laravel package to generate 64 bit identifier like the snowflake within Twitter.
Stars: ✭ 94 (+370%)
Mutual labels:  lumen

Latest Stable Version Build Status Total Downloads Scrutinizer Code Quality License

Laravel Mysql Encryption

Database fields encryption in laravel and lumen for mysql databases with native search and anonymize data.

Instalation notes

$ composer require ionghitun/laravel-lumen-mysql-encryption

Dependencies

  • php >= 8.0

Documentation:

Service provider is automatically loaded for laravel, for lumen you need to add

$app->register(IonGhitun\MysqlEncryption\MysqlEncryptionServiceProvider::class);

to your bootstrap/app.php file.

You need to add ENCRYPTION_KEY to your .env file, has to be 16 chars long.

Each of your Models should extend IonGhitun\MysqlEncryption\Models\BaseModel and for the fields you want to be encrypted you have to do the following:

  • in migrations set field to binary

  • add $encrypted to your model:

      /** @var array */
      protected $encrypted = [
          'name',
          'email'
      ];
    

You can use Validator on these fields with:

  • unique_encrypted

      unique_encrypted:<table>,<field(optional)>
    
  • exists_encrypted

      exists_encrypted:<table>,<field(optional)>
    

You cannot use basic where, orWhere, orderBy on encrypted fields so there are 5 predefined scopes that you can use as a replacer:

  - whereEncrypted
  - whereNotEncrypted
  - orWhereEncrypted
  - orWhereNotEncrypted
  - orderByEncrypted

Possibility to anonymize data:

Example:

    //without extra parameters needed for randomDigit
    protected $anonymizable = [
        'age' => ['randomDigit']
    ];
    
    //with extra parameters needed for numberBetween
    protected $anonymizable = [
        'age' => ['numberBetween', '18','50']
    ];
  • get your model instance and use anonymize method: $user->anonymize();

The method accepts a locale parameter, if you want to use faker with localization, the default locale can be set in .env file: FAKER_LOCALE = 'en_US'

If is not specified by any method above, the default Faker local will be used by default

Note: Model is not automatically saved!

Happy coding!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].