定制 entermotion/eurl 二次开发

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

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

entermotion/eurl

Composer 安装命令:

composer require entermotion/eurl

包简介

This package aims to deliver a good set of functions to easily escape URLs that will be used on HTML

README 文档

README

This package aims to deliver a good way to easily escape URLs that will be used on HTML attributes.

You should not use this package to generate URLs, ideally the URLs received here would already be escaped and safe. This project doesn't aim to encode your URL and make it browser compatible.

Goals:

  • Prevent XSS attacks
  • Avoid at maximum changing and therefore possibly break the URLs

Usage:

use eURL\Functions as eurl

$userInput = $_POST['href'];
$href = eurl\e($userInput);
$safeATag = "<a href='".$href."'>".htmlspecialchars($href)."</a>";
echo $safeATag;

Running tests:

To run the tests you must install the composer dependencies and then run:

vendor/bin/phpunit tests/TestUrls.php

Running tests with Docker:

  • Run container: docker-compose -f docker-compose_php81.yml run php sh
  • Change directory: cd /var/www/html
  • Install dependencies: composer install
  • Run tests: vendor/bin/phpunit tests/TestUrls.php

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 9
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-25