Download the PHP package miladhspr/laravel-encryptable without Composer
On this page you can find all versions of the php package miladhspr/laravel-encryptable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download miladhspr/laravel-encryptable
More information about miladhspr/laravel-encryptable
Files in miladhspr/laravel-encryptable
Package laravel-encryptable
Short Description Laravel automatic attribute encryption
License MIT
Informations about the package laravel-encryptable
Laravel Encryptable Package
Overview
laravel-encryptable
is a package that provides automatic encryption and decryption of model attributes in Laravel applications. This ensures that sensitive data is stored in an encrypted format in the database and is automatically decrypted when accessed within your application.
Features
- Automatic Encryption and Decryption: Automatically encrypts and decrypts specified attributes when interacting with your models.
- Customizable: You can define which attributes should be encrypted using the
$encryptable
property on the model. - Transparent for Queries: Queries like
where
,whereHas
,orWhere
, etc., work seamlessly with encrypted attributes. - Secure: Data is encrypted using the key defined in your
.env
file, ensuring that only your application can access it.
Installation
1. Install the Package
Run the following command to install the package via Composer:
2. Publish the Configuration (Optional)
You can publish the package's config file with the following command:
3. Enable/Disable Encryption
Set or in your .env file to enable or disable encryption globally.
4. Define Encrypted Attributes in Your Model
Use the Encryptable trait in your model and specify the $encryptable attribute for fields to be encrypted:
Usage
Inserting/Updating Data
When inserting or updating records, specified attributes in $encryptable are automatically encrypted: