Download the PHP package dbx12/data-censor without Composer

On this page you can find all versions of the php package dbx12/data-censor. 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 data-censor

Data censor

A simple tool to censor data structures.

Motivation

When documenting software, you often have to deal with data structures used in examples. Maybe an API response or request data. This data often contains sensitive information like API tokens, usernames or other personal information. Hunting these entries is tedious and should be automated, right?

Usage

Create a \dbx12\jsonCensor\Censor object, call addRule() on it for every key you want to censor and finally send your data into censor() or let Censor read it from a file and write it to another file.

A more thorough example is in example.php

Paths

A path describes an element in your input data, a bit like a CSS selector does. Every path must start with a . and end in a property name. In the example JSON below, you would address the field containing "john" with .users.name. Note how the index in the users list is unspecified. There are no numeric indices in these path descriptions. You can specify multiple paths which are subject to the same rule as array. Using ['.users.name','.users.email'] as first parameter to addRule() and ['role' => 'Admin'] as second would remove the name and email for all admins.

Conditions

A condition defines if the rule applies to that element. You can use the siblings of the selected element to decide that. You define a condition as array structure, the key describes the field, the value describes what value(s) is expected. You can use an array to define multiple allowed values. Multiple keys can be checked (all must match then).

Assume we selected .users.name in the example below and want to remove it if it belongs to a Customer or Subscriber. The rule would be: ['role' => ['Customer','Subscriber']].

Example JSON

Strategies

The strategy defines how the value (or key and value in case of an array) are censored. All strategies must implement the CensorStrategyInterface. If no strategy is specified for a rule, the ConstantCensorStrategy is used. This can be changed by modifying Censor::$defaultStrategy.

You can easily extend the functionality of this project by defining own censor strategies. Simply implement the \dbx12\jsonCensor\censorStrategies\CensorStrategyInterface with your censor logic.

Known limitations

The system works only with scalar values (e.g. string, int) and arrays (both, numeric and associative). The behavior on encountering something else (e.g. ressource or object instances) is undefined and most likely a crash.


All versions of data-censor with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
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 dbx12/data-censor contains the following files

Loading the files please wait ....