PHPackages                             moviet/panic-validator - 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. [Search &amp; Filtering](/categories/search)
4. /
5. moviet/panic-validator

ActiveLibrary[Search &amp; Filtering](/categories/search)

moviet/panic-validator
======================

A simple php validation library for php

v1.0.0(7y ago)09MITPHPPHP &gt;=7.0

Since Dec 14Pushed 7y agoCompare

[ Source](https://github.com/moviet/panic-validator)[ Packagist](https://packagist.org/packages/moviet/panic-validator)[ Docs](https://github.com/moviet/panic-validator)[ RSS](/packages/moviet-panic-validator/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Panic - A simple php validation and sanitation
==============================================

[](#panic---a-simple-php-validation-and-sanitation)

[![Build Status](https://camo.githubusercontent.com/dfc726fd31b49459fa9b5393dc8bbe3103ceb998ae6967ad28d64d5c5c814b92/68747470733a2f2f7472617669732d63692e6f72672f6d6f766965742f70616e69632d76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/moviet/panic-validator)[![License](https://camo.githubusercontent.com/1e1cb7bae9fc55a01fc5443d26e358dc21c129253bcfa9841db85c4f25aa2ecf/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e7376673f7374796c653d666c61742d737175617265)](http://doge.mit-license.org)[![Usage](https://camo.githubusercontent.com/0b08974388db1eb1c4bdd7154a157aeb6ee7ba89469165e7752420415ab89270/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f75736167652d656173792d6666363962342e737667)](https://github.com/moviet/panic-validator)[![codecov](https://camo.githubusercontent.com/0a13a6daa15affa2ab2dde34021af45ff586d6993db0057491012bd8be5f2cf3/68747470733a2f2f636f6465636f762e696f2f67682f6d6f766965742f70616e69632d76616c696461746f722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/moviet/panic-validator)[![Codacy Badge](https://camo.githubusercontent.com/685bb0be5fe974c68cb3fd45172988dca92d3e91da12060cd76ac6607ea944d4/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6665363431356638383034393438383062363963663537346439323438663964)](https://www.codacy.com/app/moviet/panic-validator?utm_source=github.com&utm_medium=referral&utm_content=moviet/panic-validator&utm_campaign=Badge_Grade)

**Panic validator** is adobted for simple lovely and easy like ***common*** validation in php

There are **no hardcoded** for simply usage, no weight and pretty useful

Preparement
-----------

[](#preparement)

- [Composer](https://getcomposer.org)
- [Clone Github](https://github.com/moviet/panic-validator.git)
- [Manual Download](https://github.com/moviet/panic-validator/archive/master.zip)

Quick Start
-----------

[](#quick-start)

#### Installations

[](#installations)

```
composer require "moviet/panic-validator"

```

Features
--------

[](#features)

- Simply Validation
- Custom Warning
- Custom Verification
- Simple Filtering
- Modify Pattern
- Validate Password
- Sanitize Html
- ❖ **Plus Bonus** ❖

Common Usage
------------

[](#common-usage)

### Simply Validation

[](#simply-validation)

- You can validate with fast direct resolve example

    ```
    require __DIR__ . '/vendor/autoload.php';

    use Moviet\Validator\Panic;
    use Moviet\Validator\Ival;

    $panic = new Panic;

    $nom = 'Smile';

    $getnom = $panic->case($nom)
                    ->rule(':alpha')
                    ->get();

    // var_dump : Smile
    ```

    The above will return value, if doesn't match will ***return false***
- Or maybe you enjoy quietly with something like this

    ```
    $data = $panic->match(':doc','mydocument.xls');

    // Output : mydocument.xls
    ```

    The above will return value, if doesn't match will ***return false***

### Custom Warning

[](#custom-warning)

- Validate using your own message

    ```
    $request = $_POST['String'];

    $post = $panic->case($request)
                  ->rule(':alNumSpace')
                  ->throw(['Do not burn your finger, invalid !!']);
    ```
- Validate using limit and custom language

    ```
    $somePost = $panic->case($_POST['String'])
                     ->lang('En') // Optional
                     ->min(3)
                     ->max(100)
                     ->rule(':alphaSpace')
                     ->throw(['Please follow wakanda alphabets']);
    ```
- Validate using empty case

    ```
    $anyPost = $panic->case(/*..Empty..*/)
                     ->rule(':alpha')
                     ->throw(['~ Gunakan angka atau spasi']);

    // Output : 'Please Fill Out The Form'
    ```

    **Notes** :

    > You can't validate an empty value, by **default** the field does not allow ***empty*** chunks

### Custom Verification

[](#custom-verification)

- You can validate for example ***html form*** like simply below

    ```
    $validUser = $panic->case($_POST['username'])
                       ->rule(':email')
                       ->throw(['Your username may error !!']);

    $validPass = $panic->case($_POST['password'])
                       ->auth(8)
                       ->throw(['Password minimum 8 characters']);

    $tokenLog  = $panic->case($_POST['csrf'])
                       ->rule(':alphaNum')
                       ->get();

    $data = [$validUser, $validPass, $tokenLog];

    if ($panic->confirm($data) !== false) {

       // $_POST['username']
       // $_POST['password']
       // ...
    }
    ```
- Render on your own template ***html form*** example

    ```

    Username *

    Password *

    ```
- If the above doesn't look so nice, you can ***trust*** with new endorse

    ```
    $product = $panic->case($_GET['product'])
                     ->rule(':alNumSpace')
                     ->throw(['Do not only look, Please bo bo boy !!']);

    $tokenId = $panic->case($_GET['token_id'])
                     ->rule(':int')
                     ->throw(['Your token of course, invalid !!']);

    $validate = [$product, $tokenId];

    $entry = $panic->trust($_GET, $validate);

    // to retrieve data, please use array

    if ($entry !== false)
    $entry[0] // Equivalent $product
    $entry[1] // Equivalent $tokenId
    Next Next...
    ```

### Simple Filtering

[](#simple-filtering)

- We use native ***filter*** functions look like below

    ```
    $url = 'https://github.com/moviet/panic-validator';

    $data = $panic->filter(':url', $url);

    // Output : https://github.com/moviet/panic-validator
    ```

### Modify Pattern

[](#modify-pattern)

- You can modify with ***modify*** like modify *your own rules*

    ```
    $myrule = $panic->case('My name is yoyo')
                    ->min(2)
                    ->max(20)
                    ->modify('/^[a-zA-Z 0-9]*$/')
                    ->throw(['What the hell something wrong ??']);

    // Return Boolen
    ```
- You may want to ***draft*** and ***match*** for non messenger

    ```
    $string = 'Thanks you';

    $data = $panic->draft('/^[a-zA-Z@0-9_1-`-02-^"?>/+\//./]*$/', $string);

    // Output : Thanks you

    $string = 'Thanks Match';

    $data = $panic->match(':message', $string);

    // Output : Thanks Match
    ```

### Validate Password

[](#validate-password)

- We put a simply for native ***password hash*** validation

    ```
    $data = $panic->verify($_POST['password'], 'DataPassword')
                  ->warn('Do not type password, please use Abcde !!');

    if ($panic->catch($data)) {

       // $_POST['password']
    }

    // Print $data => Do not type password, please use Abcde !!
    ```

### Sanitize Html

[](#sanitize-html)

- You can sanitize with our little pony for simply safe html as one packet

    ```
    $stringHtml = ' If this is XSS ';

    $filterHtml = $panic->htmlSafe($stringHtml);

    $html = $panic->htmlRaw($filterHtml);

    // Output :  If this is XSS
    ```

### Plus Bonus

[](#plus-bonus)

- Whatever usage a custom ***clean base64*** encode may interesting

    ```
    $string = 'And thanos will go on';

    $encode = $panic->base64($string);

    // Output : aOAIOAIHJSDH837287ksasjka983jsdhdsfsJHJAdsfd34dfSfb

    $decode = $panic->pure64($encode);

    // Output : And thanos will go on
    ```

### Patterns:

[](#patterns)

AttributesFormat:num0 - 9:phone+081991988xx (plus +):intInteger/Number:alphaAlphabets:alphaNumAlphabets Number:alphaSpaceAlphabets Plus Spaces:alNumSpaceAlphabets Number Spaces:queryHttp Url Query:urlUrl Address:imagejpg, jpeg, png, bmp, gif:docpdf,xls,doc,rtf,txt,ppt,pptx:addressNormal Address:subjectEmail Subject:emailEmail Address:messageSimple Message Characters### Filters:

[](#filters)

AttributesFormat:intFilter Validate Integer:floatFilter Validate Float:urlFilter Validate Url:domainFilter Validate Domain:ip4Filter Validate IP4:ip6Filter Validate IP6:emailFilter Validate EmailLicense
-------

[](#license)

`Moviet/panic-validator` is released under the MIT public license.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2708d ago

### Community

Maintainers

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

---

Top Contributors

[![moviet](https://avatars.githubusercontent.com/u/45540985?v=4)](https://github.com/moviet "moviet (30 commits)")

---

Tags

encodingphpsanitationsanitizevalidationvalidation-libraryvalidationsvalidatorvalidatorvalidationfiltersanitizephp-validationsanitationphp-validator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/moviet-panic-validator/health.svg)

```
[![Health](https://phpackages.com/badges/moviet-panic-validator/health.svg)](https://phpackages.com/packages/moviet-panic-validator)
```

###  Alternatives

[aura/filter

Filters to validate and sanitize objects and arrays.

173561.0k10](/packages/aura-filter)[htmlawed/htmlawed

Official htmLawed PHP library for HTML filtering

401.1M9](/packages/htmlawed-htmlawed)[wandersonwhcr/romans

A Simple PHP Roman Numerals Library

44395.1k8](/packages/wandersonwhcr-romans)[kalfheim/sanitizer

Data sanitizer for PHP with built-in Laravel support.

1423.7k](/packages/kalfheim-sanitizer)

PHPackages © 2026

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