Download the PHP package directorytree/privacy-filter without Composer

On this page you can find all versions of the php package directorytree/privacy-filter. 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 privacy-filter

Privacy Filter

Tests status Total downloads Latest version License

Install and use compiled privacy-filter.cpp binaries from Laravel applications.

Introduction

Privacy Filter provides a Laravel wrapper around the privacy-filter.cpp command line binary. It installs the compiled binary for the current operating system, downloads the GGUF model used by the binary, and exposes a small PHP API for detecting private entities in text.

Installation

You may install the package via Composer:

After installing the package, run the privacy-filter:install Artisan command. This command will install both the compiled binary and the GGUF model required by the runtime API:

If either file already exists, the installer will leave it in place. You may use the --force option to overwrite the installed files:

Configuration

You may publish the package configuration file using the vendor:publish Artisan command:

The published configuration file allows you to customize the installed binary path, model path, process timeout, model URL, and binary release source:

Installing Assets

The privacy-filter:install command installs all assets required by the package:

You may install the binary and model independently if you need more control over deployment:

The binary installer downloads the correct archive for the current operating system from the configured GitHub release. You may install a different release or provide a direct archive URL:

The model installer downloads the configured GGUF model. You may also provide a direct model URL:

Usage

You may classify text using the PrivacyFilter facade. The entities method returns an array of Entity instances:

Each entity contains the detected type, original text, byte offsets, and confidence score. You may also retrieve the byte length of the entity:

You may use the detected entities to redact personal information from text:

Thresholds

The classifier uses a default threshold of 0.5. Only entities with a confidence score equal to or greater than the threshold will be returned.

You may provide a threshold at runtime when classifying text:

Queueing And Memory

Privacy Filter runs the native privacy-filter.cpp binary when classifying text. The GGUF model is loaded into memory by the native process while classification is running. Larger models require more memory.

For production workloads, you should avoid running many classifications concurrently from normal web requests. Instead, dispatch classification work to a dedicated queue and limit the number of workers assigned to that queue based on the memory available on your server.

For example, if your selected model uses approximately 3 GB of memory while classifying, running four concurrent workers may require approximately 12 GB of memory, plus memory used by PHP, Redis, your database, and the rest of your application.

A typical Horizon configuration may dedicate a small worker pool to privacy filtering:

You may then dispatch redaction or classification work to the dedicated queue:

Tune the processes value according to your server memory and model size. Each concurrent classification may load its own copy of the model into memory.

Entity Types

The raw entity type is available through the entity's type property:

For known privacy-filter entity types, you may retrieve the matching EntityType enum instance:

If the binary returns an entity type that is not known by this package, the type method will return null.

Testing

You may use the fake method to prevent the package from invoking the installed binary during tests. The fake method accepts a list of entities that should be returned for every classification:

You may also fake responses for specific text using exact strings or wildcard patterns:


All versions of privacy-filter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-zip Version *
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
directorytree/privacy-filter-classifier Version ^1.1
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 directorytree/privacy-filter contains the following files

Loading the files please wait ...