定制 linio/safeecho 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

linio/safeecho

Composer 安装命令:

composer require linio/safeecho

包简介

Lightweight function to easily hide printed data.

README 文档

README

Purpose

Replacement function for echo/print. It will take the string, hide it and then wrap the new hidden string with whatever wrapper is specified.

echo John Smith will print John Smith

Out-of-the-box safeecho('John Smith') will print J*** S****

With a configuration file safeecho('John Smith') can print <span style="cursor: pointer;" onmouseout="this.innerHTML='J*** S****'" onmouseover="this.innerHTML='John Smith'">J*** S****</span>

Installation

The supported way of installing safeecho is via Composer.

$ composer require linio/safeecho

Autoload function

In the composer.json file, add or append to the "autoload" field,

"autoload": {
    "files": [
        "vendor/linio/safeecho/src/safeecho.php"
    ]
}

Configure safeecho Output

To override the default configuration of safeecho, you will need a configuration file.

Accepted file names are: safeecho.ini safeecho.json safeecho.php safeecho.xml safeecho.yaml safeecho.yml

Configuration files are searched for in the above order. The first configuration file found, is the configuration that is used.

The recommended location for the configuration is the project root directory.

Example YML Configurations

safeecho.yml

decorator: Linio\SafeEcho\Decorator\MouseHoverDecorator

If you want to change the 'hideChar'

safeecho.yml

decorator: Linio\SafeEcho\Decorator\MouseHoverDecorator
hideChar: '~'

safeecho('John Smith') will now print <span style="cursor: pointer;" onmouseout="this.innerHTML='J~~~ S~~~~'" onmouseover="this.innerHTML='John Smith'">J~~~ S~~~~</span>

To use your own custom Decorator:

  • YourCustomDecorator must extend SafeEchoDecorator

safeecho.yml

decorator:
    class: \Path\To\YourCustomDecorator
    arguments:
        arg1: arg1Value
        arg2: arg2Value

Please see safeecho Configuration File for configuration file examples.

Testing

$ vendor/bin/phpunit

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固