Download the PHP package ercsctt/laravel-file-encryption without Composer

On this page you can find all versions of the php package ercsctt/laravel-file-encryption. 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 laravel-file-encryption

Laravel File Encryption

A robust file encryption package for Laravel using AES-256-GCM authenticated encryption. Designed for secure, efficient encryption and decryption of files of any size with streaming support for memory-efficient processing of large files.

Features

Requirements

Installation

Install the package via Composer:

The package will automatically register its service provider.

Configuration

Publish the configuration file:

This will create a config/file-encryption.php file.

Environment Variables

Add the following to your .env file:

Generate a key using:

Optional configuration:

Usage

Using the Facade

Using the Helper Function

Direct Instantiation

Artisan Commands

Encrypt Command

Options: Option Description
--key= Encryption key (base64-encoded). Uses configured key if not provided
-R, --recursive Recursively encrypt all files in a directory
--force Skip confirmation prompts
--chunk-size=65536 Chunk size in bytes for streaming
--prune Delete original files after successful encryption

Examples:

Decrypt Command

Options: Option Description
--key= Decryption key (base64-encoded)
-R, --recursive Recursively decrypt all .enc files in a directory
--force Skip confirmation prompts
--keep Keep encrypted files after successful decryption
--output= Custom output path for decrypted file
--scan Scan entire project for encrypted (.enc) files

Examples:

Common Workflows

Encrypt sensitive uploads for storage:

Decrypt files for processing, then re-encrypt:

Find and decrypt all encrypted files in a project:

Migrate to a new encryption key:

Streaming Large Files

For large files, use decryptedStream() for memory-efficient processing:

Progress Callbacks

Monitor progress when processing large files:

Key Rotation

When you need to rotate your encryption key:

  1. Generate a new key:

  2. Update your .env file:

  3. The package will automatically try previous keys when decrypting files encrypted with old keys.

  4. Programmatically configure previous keys:

Security Features

File Format

Encrypted files use the following binary format:

Error Handling

The package throws specific exceptions for different error conditions:

Key Validation

Testing

Run the test suite:

Or with PHPUnit directly:

API Reference

FileEncrypter Methods

Method Signature Description
encryptFile (string $source, ?string $dest = null, ?callable $progress = null): void Encrypt a file. Destination defaults to $source.enc
decryptFile (string $source, ?string $dest = null, ?callable $progress = null): void Decrypt a file. Destination defaults to source without .enc
decryptedContents (string $path): string Return entire decrypted file contents as string
decryptedStream (string $path, callable $callback): void Stream decrypted chunks through callback
isEncrypted (string $path): bool Check if file has encryption magic bytes
previousKeys (array $keys): static Set previous keys for key rotation (fluent)
getKey (): string Get primary encryption key
getChunkSize (): int Get configured chunk size
getAllKeys (): array Get all keys (primary + previous)

License

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


All versions of laravel-file-encryption with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-openssl Version *
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/filesystem Version ^11.0|^12.0|^13.0
symfony/finder Version ^7.0|^8.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 ercsctt/laravel-file-encryption contains the following files

Loading the files please wait ...