Download the PHP package hamoi1/eloquent-encryptable without Composer

On this page you can find all versions of the php package hamoi1/eloquent-encryptable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package eloquent-encryptable

🔐 Eloquent Encryptable

Laravel PHP Hill Cipher

A powerful Laravel package for encrypting Eloquent model attributes using the Hill Cipher algorithm with multi-language support.

License Version Laravel Version


✨ Features


📋 Table of Contents


🚀 Installation

Install the package via Composer:

Publish the configuration file:


⚙️ Configuration

After publishing, configure your encryption settings in config/eloquent-encryptable.php:

🔑 Key Matrix Requirements

Example valid matrices:


📖 Usage

Basic Usage

Add the EncryptAble trait to your Eloquent model and define the $encryptAble property:

Now your specified attributes will be automatically encrypted when saving and decrypted when retrieving:

Validation Rules

The package provides custom validation rules for encrypted fields:

Unique Rule

Ensure encrypted field values are unique:

Exists Rule

Validate that encrypted field value exists:

Blade Directives

Use convenient Blade directives in your views:

Example in a Blade template:

Console Commands

Re-encrypt Data

When rotating encryption keys, use the console command to re-encrypt existing data:

This command will:

  1. Load models from the configuration
  2. Decrypt data using the previous key
  3. Re-encrypt using the new key
  4. Show progress bars and timing information
  5. Process data in chunks for memory efficiency

🔧 Advanced Usage

Manual Encryption/Decryption

Access the encryption service directly:

Batch Operations

Process multiple model attributes:

Custom Key Matrix Generation

Generate a random invertible key matrix:


📚 API Reference

EncryptAble Trait

Method Description
bootEncryptAble() Automatically encrypts/decrypts model attributes

EloquentEncryptAbleService

Method Parameters Description
encrypt(string $word) $word - Text to encrypt Encrypts a string using Hill cipher
decrypt(string $encrypted, bool $previousKey = false) $encrypted - Encrypted text
$previousKey - Use previous key
Decrypts a string
encryptModelData(array $data, array $fields) $data - Model data
$fields - Fields to encrypt
Encrypts specified model fields
decryptModelData(array $data, array $fields) $data - Model data
$fields - Fields to decrypt
Decrypts specified model fields
reEncryptModelData(array $data, array $fields) $data - Model data
$fields - Fields to re-encrypt
Re-encrypts using new key

Validation Rules

Rule Constructor Parameters Description
EncryptAbleUniqueRule $table, $column, $except = [] Validates uniqueness of encrypted field
EncryptAbleExistRule $table, $column, $except = [] Validates existence of encrypted field

🔍 Troubleshooting

Common Issues

1. Invalid Key Matrix Error

Solution: Ensure your key matrix is:

2. Memory Issues with Large Datasets

Solution: The re-encrypt command processes data in chunks of 100. For very large datasets, consider:

3. Character Encoding Issues

Solution: Ensure your database columns support UTF-8 encoding:

Debug Mode

Enable debug logging by adding to your model:


🤝 Contributing

We welcome contributions! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Follow the development setup below
  4. Make your changes and add tests
  5. Ensure all tests pass and code follows PSR-12 standards
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Development Setup

  1. Clone the repository

  2. Install dependencies

  3. Set up testing environment

  4. Create test configuration Create config/eloquent-encryptable.php for testing:

Project Structure

Adding New Features

When adding new features:

  1. Create tests first (TDD approach)
  2. Follow existing patterns in the codebase
  3. Update documentation in README.md
  4. Add PHPDoc comments for all public methods
  5. Consider backward compatibility

📄 License

This package is open-sourced software licensed under the MIT license.


All versions of eloquent-encryptable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hamoi1/eloquent-encryptable contains the following files

Loading the files please wait ....