tobymaxham/array-faker-redactor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tobymaxham/array-faker-redactor

Composer 安装命令:

composer require tobymaxham/array-faker-redactor

包简介

A PHP package to redact or fake array values by their keys.

README 文档

README

A PHP package to redact or fake array values by their keys no matter how deep the array.

Latest Version on Packagist GitHub commits Total Downloads GitHub contributors GitHub issues

Notice

This packages uses the mtownsend/array-redactor package by mtownsend5512 and the Faker library by fzaninotto. So for more details to those packages look at the repositories readme files:

Why

Sometimes you need to customized your data to protect the privacy of your users or the security of your application. This is no longer a problem with this package.

With this package, an element of an array or a JSON, no matter how deep, can be easily deleted, redact or faked. This allows you to customize the response of your server or api and pass it on without worry.

Installation

Install via composer:

composer require tobymaxham/array-faker-redactor

Quick start

Using the class

use TobyMaxham\ArrayFakerRedactor\ArrayFakerRedactor;

// An example array, maybe a request being made to/from an API application
$content = [
    'email'       => 'git2019@maxham.de',
    'phone'       => '1234567',
    'password'    => 'secret123',
    'notes'       => 'this can be removed',
    'sample_data' => 'nothing else matters',
];

$redactor = (new ArrayFakerRedactor())->content($content)->keys(['email', 'password', 'notes', 'sample_data' => 'random'])->withFaker()->redact();

// $redactor will return something like:
[
    'email'       => 'russel94@hotmail.com',
    'phone'       => '1234567',
    'password'    => ']61i8~}DJB',
    'notes'       => '[REDACTED]',
    'sample_data' => 'e2k9aDUoeXRFQzhP',
];

Advanced usage

You can also add your own FakerProvider (see Faker Docs).

$content = [
    'key' => 'some data',
];

$redactor = (new ArrayFakerRedactor())->content($content)->keys(['key' => 'myformatter'])
    ->withFaker()
    ->addFakerProvider(MyProvider::class)
    ->redact();

Testing

You can run the tests with:

./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

  • TobyMaxham

License

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

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固