承接 maximantonisin/veles-hide-string 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

maximantonisin/veles-hide-string

Composer 安装命令:

composer require maximantonisin/veles-hide-string

包简介

String security/anonymous hide

README 文档

README

img img img

Author

Maxim Antonisin
maxim.antonisin@gmail.com
Linkedin

Description

This package is designed and implemented to work with text/strings to replace/hide sensitive information.

Requirements

img img img

  • PHP 7.2+
  • composer
  • symfony/twig-bridge

Options

  • length - Number of chars to be replaced.
  • offset - Number of chars to skip before replace.
  • hideChar - Special symbol used for replace.

Use

String (MaximAntonisin\Veles\Type\StringTypeInterface::class)

Options

No additional options for this string type format. This type is default.

Replace chars

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\StringTypeInterface;

$result = VelesHide::hide('exampleDomainName@example.com', [
    StringTypeStringTypeInterface::OPTION_LENGTH  => 4,
    StringTypeInterface::OPTION_OFFSET  => 2,
]);
var_dump($result);

//string(29) "ex****eDomainName@example.com"

Email (MaximAntonisin\Veles\Type\EmailTypeInterface::class)

Options

  • domainLength - Number of chars to be replaced in domain part.
  • domainOffset - Number of chars to be skipped to replace in domain part.

Basic usage

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\EmailTypeInterface;

$result = VelesHide::hide('exampleDomainName@example.com', [
    EmailTypeInterface::OPTION_LENGTH  => 4,
    EmailTypeInterface::OPTION_OFFSET  => 2,
], 'email');
var_dump($result);

//string(29) "ex****eDomainName@example.com"

Replace in email name and domain parts

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\EmailTypeInterface;

$result = VelesHide::hide('exampleDomainName@example.com', [
    EmailTypeEmailTypeInterface::OPTION_DOMAIN_LENGTH => 4,
    EmailTypeInterface::OPTION_DOMAIN_OFFSET => 2,
], 'email');

var_dump($result);

//string(29) "e****leDomainName@ex****e.com"

Replace only in email domain part

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\EmailTypeInterface;

$result = VelesHide::hide('exampleDomainName@example.com', [
    EmailTypeInterface::OPTION_LENGTH        => 0,
    EmailTypeInterface::OPTION_DOMAIN_LENGTH => 4,
    EmailTypeInterface::OPTION_DOMAIN_OFFSET => 2,
], 'email');
var_dump($result);

//string(29) "exampleDomainName@ex****e.com"

Url (MaximAntonisin\Veles\Type\UrlTypeInterface::class)

Options

  • schemeLength - Number of chars to be replaced in scheme part.
  • schemeOffset - Number of chars to be skipped on replace in scheme part.
  • queryLength - Number of chars to be replaced in query part.
  • queryOffset - Number of chars to be skipped on replace in query part.
  • pathLength - Number of chars to be replaced in path part.
  • pathOffset - Number of chars to be skipped on replace in path part.

Basic Usage

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;

$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
    UrlTypeInterface::OPTION_LENGTH  => 4,
    UrlTypeInterface::OPTION_OFFSET  => 2,
], 'url');
var_dump($result);

//string(23) "https://fo****ample.com"

Replace in scheme

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;

$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
    UrlTypeInterface::OPTION_LENGTH         => 0,
    UrlTypeInterface::OPTION_SCHEME_LENGTH  => 2,
    UrlTypeInterface::OPTION_SCHEME_OFFSET  => 2,
], 'url');
var_dump($result);

//string(23) "ht**s://foo.example.com"

Replace in path

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;

$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
    UrlTypeInterface::OPTION_LENGTH       => 0,
    UrlTypeInterface::OPTION_PATH_LENGTH  => 6,
    UrlTypeInterface::OPTION_PATH_OFFSET  => 2,
], 'url');
var_dump($result);

//string(41) "https://foo.example.com/p******/something"

Replace in query

use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;

$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
    UrlTypeInterface::OPTION_LENGTH        => 0,
    UrlTypeInterface::OPTION_PATH_LENGTH   => 0,
    UrlTypeInterface::OPTION_QUERY_LENGTH  => 4,
    UrlTypeInterface::OPTION_QUERY_OFFSET  => 2,
], 'url');
var_dump($result);

//string(63) "https://foo.example.com/path/to/something?qu****aram=queryValue"

Support

sleepwalker Buy Me a Coffee at ko-fi.com

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固