Download the PHP package edyan/neuralyzer without Composer

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

Scrutinizer Code Quality Code Coverage Build Status Build Status

edyan/neuralyzer

Summary

This project is a library and a command line tool that anonymizes a database by updating data or generating fake data (update vs insert). It uses Faker to generate data from rules defined in a configuration file.

As it can do row per row or use batch mechanisms, you can load tables with dozens of millions of fake records.

It uses Doctrine DBAL to abstract interactions with databases. It's then supposed to be able to work with any database type. Currently it works (tested extensively) with MySQL, PostgreSQL and SQLServer.

~~Neuralyzer has an option to clean tables by injecting a DELETE FROM with a WHERE critera before launching the anonymization (see the config parameters delete and delete_where).~~

Neuralyzer had an option to clean tables but it's now managed by pre and post actions :

Installation as a library

Installation as an executable

You can even download the executable directly (example with v3.1):

Usage

The easiest way to use that tool is to start with the command line tool. After cloning the project and running a composer install, try:

Generate the configuration automatically

Neuralyzer is able to read a database and generate the configuration for you. The command config:generate accepts the following options:

Example

That produces a file which looks like:

You have to modify the file to change its configuration. For example, if you need to remove data while anonymizing and change the language (see Faker's doc for available languages), do :

INFO: You can also use delete in standalone, without anonymizing anything. That will delete everything in books:

If you wanted to delete everything then insert 1000 new books:

Run the anonymizer

To run the anonymizer, the command is simply "run" and expects:

Example

That produces that kind of output:

WARNING: On a huge table, --sql will produce a HUGE output. Use it for debugging purpose.

Library

The library is made to be integrated with any Tool such as a CLI tool. It contains:

Guesser

The guesser is the central piece of the config generator. It guesses, according to the field name or field type what type of faker method to apply.

It can be extended very easily as it has to be injected to the Writer.

Configuration Writer

The writer is helpful to generate a yaml file that contains all tables and fields from a DB. A basic usage could be the following:

If you need, you can protect some cols (with regexp) or tables:

Configuration Reader

The configuration Reader is the exact opposite of the Writer. Its main job is to validate that the configuration of the yaml file is correct then to provide methods to access its parameters. Example:

DB Anonymizer

The only anonymizer currently available is the DB one. It expects a PDO and a Configuration Reader objects:

Once initialized, the method that anonymize the table is the following:

Parameters:

A few options can be set by calling :

Full Example:

Pre and Post Actions

You can set an array of pre_actions and post_actions that will be executed before and after neuralyzer starts to anonymize an entity.

These actions are actually symfony expressions (see Symfony Expression Language) that rely on Services. These Services are loaded from the Service/ directory.

For now there is only one service : Database that contains a method query usable like that : db.query("DELETE FROM table").

Configuration Reference

bin/neuralyzer config:example provides a default configuration with all parameters explained :

Custom application logic

When using custom doctrine types doctrine will produce an error that the type is not know. This can be solved by providing a bootstrap file to register the custom doctrine type.

bootstrap.php

Then provide the bootstrap file to the run command:

Development

Neuralyzer uses Robo to run its tests (via Docker) and build its phar.

Clone the project, run composer install then...

Run the tests

With MySQL

With PostgreSQL 9, 10 and 11 (12 also works)

With SQL Server

Warning : 2 tests fail, because of strange behaviors of SQL Server ... or Doctrine / Dbal. PHPUnit can't compare 2 Datasets because the fields are not in the same order.

Build a release (with a phar and a git tag)

Build the phar only

Improve code quality with phpinsights

Update dependencies to make sure it'll work with PHP 7.2


All versions of neuralyzer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
ext-pdo Version *
doctrine/dbal Version ^2
fakerphp/faker Version ^1
symfony/config Version ^5
symfony/console Version ^5
symfony/dependency-injection Version ^5
symfony/expression-language Version ^5
symfony/finder Version ^5
symfony/stopwatch Version ^5
symfony/yaml Version ^5
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 edyan/neuralyzer contains the following files

Loading the files please wait ....