jivemonkey2000/larabits
A collection of useful Laravel bits.
122
| Install | |
|---|---|
composer require jivemonkey2000/larabits |
|
| Latest Version: | v1.0.3 |
| PHP: | >=5.6.4 |
| License: | MIT |
| Last Updated: | Aug 27, 2020 |
| Links: | GitHub · Packagist |
Maintainer: jivemonkey2000
Larabits
A place for helpful collection of Laravel bits and bobs to reside.
Eloquent
Attribute Encryption
Add attribute level encryption to your Eloquent models in just a few steps:
- Import
Larabits\Eloquent\AttributeEncryptionat the top of your class - Add an
$encryptarray property and populate it with attributes you wish to encrypt - Add
use AttributeEncryptionto your Eloquent models
Just like this:
<?php
use Illuminate\Database\Eloquent\Model;
use Larabits\Eloquent\AttributeEncryption;
class User extends Model
{
use AttributeEncryption;
/**
* The attributes that should be encrypted.
*
* @var array
*/
protected $encrypt = [
'email',
'secret',
];
}
If required, encryption can be enabled and disabled by using your .env file to set an APP_ENABLE_ENCRYPTION constant false. This is sometimes useful for testing, for example when using seeInDatabase('table',['foo' => 'bar']);.
Installing
To install Larabits, either add it your composer.json or do a composer require jivemonkey2000/larabits from your project root.
composer require jivemonkey2000/larabits
Related Packages
betterapp/laravel-db-encrypter
Provides database model attribute encryption/decryption
667,360
363
attribute
database
database encrypter
database encryption
decrypt
decrypted
decryption
eloquent
encrypt
encrypter
encryption
laravel
laravel attribute encrypter
laravel attribute encryption
laravel database encrypter
laravel database encryption
laravel db encrypter
laravel db encryption
laravel model encrypter
laravel model encryption
sagalbot/encryptable
Allows you to store Eloquent properties encrypted in your database, and automati...
58,536
27