ap-lib/sanitizer 问题修复 & 功能扩展

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

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

ap-lib/sanitizer

Composer 安装命令:

composer require ap-lib/sanitizer

包简介

A library that sanitize some mixed variable to simple types: int, string, array, bool, null

README 文档

README

MIT License

A library that normalizes some mixed variable to simple types: int, string, array, bool, null

Installation

composer require ap-lib/sanitizer

Features

  • Allowed custom sanitizers

Requirements

  • PHP 8.3 or higher

Getting started

$sanitizer = new BaseSanitizer([
    new ThrowableSanitizer(include_trace: false)
]);



$sanitizedObject = $sanitizer->sanitize([
    "message"   => "some error message",
    "exception" => new Exception("file not found", 1543),
]);

$sanitizedArray = $sanitizedObject->value;

var_export($sanitizedArray);
/*
[
    'message'   => 'some error message',
    'exception' =>
        [
            'type'    => 'Exception',
            'message' => 'file not found',
            'file'    => '/code/path/to/file.php',
            'line'    => 19,
            'code'    => 1543,
        ],
]
*/

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-07