PHPackages                             ssteele/wp-typesanity - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ssteele/wp-typesanity

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

ssteele/wp-typesanity
=====================

Sanitize input by type when using WordPress

1.1.0(8y ago)118MITPHP

Since Mar 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ssteele/wp-typesanity)[ Packagist](https://packagist.org/packages/ssteele/wp-typesanity)[ Docs](https://github.com/ssteele/wp-typesanity)[ RSS](/packages/ssteele-wp-typesanity/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

WP Typesanity
-------------

[](#wp-typesanity)

*A WordPress plugin that sanitizes user input by unit type*

### Description

[](#description)

WP Typesanity delivers a consistent experience when dealing with the various base PHP unit types in the WordPress environment. All input is stringified and filtered through `wp_kses` to remove markup and "evil scripts". You can pass a second parameter to `sanitize` to specify an expected unit type. Strings, integers, and floats are verified and expected data is kept. Unexpected data is set to an empty string. Now you are free to develop as fast as you like knowing the unit types you're dealing with are what you expect. See table below for a breakdown of unit type expectations:

inputstringintegerfloat'foo''foo''''''1''1''1''1''0''0''0''0''1.2''1.2''1''1.2''0.0''0.0''0''0.0''true''true''''''false''false'''''1'1''1''1'0'0''0''0'1.2'1.2''1''1.2'0.0'0.0''0''0.0'true'true'''''false'false'''''### Setup

[](#setup)

Navigate to your plugin via the terminal and issue:

`composer require ssteele/wp-typesanity`

### Documentation

[](#documentation)

Sanitize user input:

```
$translator = new UserInput();
$_POST = [
    'name' => 'Steve Steele',
    'id'   => 1,
    'gpa'  => 3.9,
];
$name = $translator->sanitize($_POST['name']);          // sanitize name

```

Pass in optional parameter \[s\]tring, \[i\]nteger, or \[f\]loat to ensure proper data type:

```
$name = $translator->sanitize($_POST['name'], 's');     // sanitize name as string
$id = $translator->sanitize($_POST['id'], 'i');         // sanitize id as integer
$gpa = $translator->sanitize($_POST['gpa'], 'f');       // sanitize gpa as float

```

Bulk sanitize an array of user input:

```
$post = $translator->sanitize($_POST);                  // sanitize all post elements
$post = $translator->sanitize($_POST, 'i');             // sanitize all post elements as integer
$post = $translator->sanitize($_POST, ['s', 'i', 'f']); // sanitize all post elements (of known order) against respective types

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

2972d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b59771f462eb1c2bd705f807be8fc399e3d7ed5e7361c68ed9daabe793c19af8?d=identicon)[ssteele](/maintainers/ssteele)

---

Top Contributors

[![ssteele](https://avatars.githubusercontent.com/u/2633534?v=4)](https://github.com/ssteele "ssteele (17 commits)")

---

Tags

inputsanitizewordpress-plugintypewordpressinputsanitize

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ssteele-wp-typesanity/health.svg)

```
[![Health](https://phpackages.com/badges/ssteele-wp-typesanity/health.svg)](https://phpackages.com/packages/ssteele-wp-typesanity)
```

###  Alternatives

[elegantweb/sanitizer

Sanitization library for PHP and the Laravel framework.

115950.4k2](/packages/elegantweb-sanitizer)[abcaeffchen/sepa-utilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP &gt;= 8.1.

312.0M2](/packages/abcaeffchen-sepa-utilities)[surgiie/transformer

A data transforming/formatting package for php.

12724.3k1](/packages/surgiie-transformer)[aura/input

This package contains tools to describe and filter user inputs from an HTML form, including sub-forms/sub-fieldsets, fieldset collections, an interface for injecting custom filter systems, and CSRF protection. Note that this package does not include output functionality, although the "hints" provided by the Form object can be used with any presentation system to generate an HTML form.

6678.4k4](/packages/aura-input)[erlandmuchasaj/sanitize

A package to sanitize your input.

146.0k](/packages/erlandmuchasaj-sanitize)[romeoz/rock-sanitize

Flexible sanitizator for PHP.

4720.1k9](/packages/romeoz-rock-sanitize)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
