Download the PHP package dynamik-dev/cloak-laravel without Composer

On this page you can find all versions of the php package dynamik-dev/cloak-laravel. 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 cloak-laravel

Cloak for Laravel

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Keep PII out of LLMs. Cloak masks sensitive data before sending text to AI APIs like ChatGPT or Claude, then restores the original data in responses.

Quick Start

Why Cloak?

When building AI-powered features, user messages often contain sensitive information—emails, phone numbers, SSNs, credit cards. Sending this data to third-party LLM APIs creates privacy and compliance risks.

Cloak solves this by:

  1. Detecting PII using built-in or custom detectors
  2. Replacing sensitive data with placeholder tokens
  3. Storing the mapping temporarily (in-memory or cache)
  4. Restoring original data when you receive the LLM's response

The LLM never sees the actual PII, but your users get personalized responses.

Installation

Optionally publish the config file:

Configuration

Encryption at Rest

This Laravel adapter integrates with cloak-php v0.2.0's encryption system using Laravel's Crypt facade. All sensitive data is encrypted before being stored, providing defense in depth—even if memory or cache is compromised, the original PII remains protected.

The encryption is handled through a custom LaravelEncryptor that implements cloak-php's EncryptorInterface, using Laravel's built-in encryption for seamless integration with your application's APP_KEY.

Persist Mode

Usage

Helper Functions

The simplest way to use Cloak:

Facade

Dependency Injection

Real-World Example: OpenAI Integration

Built-in Detectors

Cloak automatically detects:

Type Example Placeholder
Email [email protected] {{EMAIL_x1y2z3_1}}
Phone 555-123-4567 {{PHONE_x1y2z3_1}}
SSN 123-45-6789 {{SSN_x1y2z3_1}}
Credit Card 4111-1111-1111-1111 {{CREDIT_CARD_x1y2z3_1}}

By default, all detectors run. To use specific detectors:

Custom Detectors

Pattern Detector (Regex)

Word Detector

Callback Detector

For complex detection logic:

Middleware Example

Auto-cloak sensitive data in request logs:

Testing

Version Compatibility

This package has been updated to work with cloak-php v0.2.0, which includes:

What Changed in v0.2.0

Architecture improvements:

Container Binding Strategy (Octane-safe):

This architecture prevents issues with filters, callbacks, and other stateful configurations, especially in Laravel Octane environments where state can leak between requests.

Breaking changes from previous versions:

The package maintains backward compatibility at the API level—all helpers, facades, and configuration options work the same way for end users.

Advanced Usage: Extending Cloak

The resolver pattern allows developers to customize Cloak behavior through the container:

Each call to cloak() or app(Cloak::class) gets a fresh instance with your customizations, preventing state pollution across requests.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of cloak-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
dynamik-dev/cloak-php Version ^0.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0
illuminate/support Version ^10.0||^11.0||^12.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 dynamik-dev/cloak-laravel contains the following files

Loading the files please wait ...