PHPackages                             clean/assure - 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. clean/assure

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

clean/assure
============

Data correction and validation

3.0.0(9y ago)122.1kMITPHPCI failing

Since Nov 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/clean/assure)[ Packagist](https://packagist.org/packages/clean/assure)[ RSS](/packages/clean-assure/feed)WikiDiscussions master Synced 1mo ago

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

clean/assure
============

[](#cleanassure)

[![Build Status](https://camo.githubusercontent.com/6d3f7a725852eedbec948ea61ef8ed5a17d969d6ef7cfac2bba2239c475bc2f2/68747470733a2f2f7472617669732d63692e6f72672f636c65616e2f6173737572652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/clean/assure)[![Code Climate](https://camo.githubusercontent.com/1862adf136cf4df66e671ac75b6ce4f20c553e9d122f37cd078d93f8eab780c9/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f636c65616e2f6173737572652f6261646765732f6770612e737667)](https://codeclimate.com/github/clean/assure)[![Test Coverage](https://camo.githubusercontent.com/6971d298217049d71733c6da419c5e8ac4de25339fc5ac16425a2e7a86502913/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f636c65616e2f6173737572652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/clean/assure/coverage)[![Issue Count](https://camo.githubusercontent.com/85361ccf204ced134f6e240d33155cff592f3c0be75d7fef7dc486a5fe23dfec/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f636c65616e2f6173737572652f6261646765732f69737375655f636f756e742e737667)](https://codeclimate.com/github/clean/assure)[![Latest Stable Version](https://camo.githubusercontent.com/2401f74bb8639b07db6e187ed7e7986b113a5209f8a997e2c7094106f8170af1/68747470733a2f2f706f7365722e707567782e6f72672f636c65616e2f6173737572652f762f737461626c65)](https://packagist.org/packages/clean/assure)[![Total Downloads](https://camo.githubusercontent.com/33e4c05fe864eadd2fb8a3e73b5a9a03084a3ffd105f571c5fe4c44915092718/68747470733a2f2f706f7365722e707567782e6f72672f636c65616e2f6173737572652f646f776e6c6f616473)](https://packagist.org/packages/clean/assure)[![License](https://camo.githubusercontent.com/1d63c5d274457a0fb831566d7848fad0267042c0e12675dc54b580bc41de1ae2/68747470733a2f2f706f7365722e707567782e6f72672f636c65616e2f6173737572652f6c6963656e7365)](https://packagist.org/packages/clean/assure)

This package extends global namespace with assure method than can be used to correct and validate mixed data types.

Mainly used to support duck typing of primitive types in function parameters to simplify interface usage eg.:

```
class Foo
{
    public function filterById($id)
    {
        assure($name, ['arrayOfIntegers']);
        // after assure we can trust that name is an array of integers
        // otherwise exception will be raised
    }
}

$foo = new Foo();
$foo->filterById(1)
$foo->filterById('1')
$foo->filterById(['1', 2])
```

Installation
------------

[](#installation)

via [Composer](https://packagist.org/packages/clean/assure)

Example of Usage
----------------

[](#example-of-usage)

```
// if value is not integer and cannot be transform to integer assure with throw exception
// correct values: '1', 1, 1.3
// invalid values: 'a', NULL, false, array()
assure($value, 'integer');

// if not integer OR string with integers separated by commas assure will throw exception
// correct values: '1', '1,2,3,4,5';
// invalid values: 'a', '1,2,a,4,b';
assure($value, ['integer', 'commaSeparatedIntegers']);
```

Documentation
-------------

[](#documentation)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 93.3% 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 ~162 days

Total

5

Last Release

3569d ago

Major Versions

1.0.0 → 2.0.02015-05-03

2.0.2 → 3.0.02016-08-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/21d3fe3ceb74869ffa1dd2ca9aac14d6df3e9e4209cfa8ed9c602875d590959b?d=identicon)[romannowicki](/maintainers/romannowicki)

---

Top Contributors

[![perform-group](https://avatars.githubusercontent.com/u/14273063?v=4)](https://github.com/perform-group "perform-group (56 commits)")[![peengle](https://avatars.githubusercontent.com/u/305179?v=4)](https://github.com/peengle "peengle (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/clean-assure/health.svg)

```
[![Health](https://phpackages.com/badges/clean-assure/health.svg)](https://phpackages.com/packages/clean-assure)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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