PHPackages                             geofmureithi/f3-validate - 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. geofmureithi/f3-validate

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

geofmureithi/f3-validate
========================

A validation lib for Fat Free Framework

1.1(7y ago)2934912[2 issues](https://github.com/geofmureithi/f3-validate/issues)[4 PRs](https://github.com/geofmureithi/f3-validate/pulls)MITPHP

Since Sep 9Pushed 5y ago5 watchersCompare

[ Source](https://github.com/geofmureithi/f3-validate)[ Packagist](https://packagist.org/packages/geofmureithi/f3-validate)[ RSS](/packages/geofmureithi-f3-validate/feed)WikiDiscussions master Synced 2d ago

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

Fat Free Framework Validator
============================

[](#fat-free-framework-validator)

An easy to use and strait to the point validation trait for Fat Free Framework

[![Build Status](https://camo.githubusercontent.com/71ff8a33fcf8fc82f52421720b5a9f05af5064d611c9cc81e353625c4f7de22d/68747470733a2f2f7472617669732d63692e6f72672f67656f666d757265697468692f66332d76616c69646174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/geofmureithi/f3-validate)

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

[](#installation)

##### Using Composer

[](#using-composer)

```
composer require geofmureithi/f3-validate
```

##### Manually

[](#manually)

Copy the `lib\validate.php` file to the lib folder or any root of an auto included folder.

**Remember it requires at least php 5.4 to use traits**

Getting Started
---------------

[](#getting-started)

```
class Profile
{
    use Validate; // "reqired|email"
        ];
    }

    public function save()
    {
        //.....
    }
}

$data = $f3->get('POST')
$profile = new Profile();
$result = $profile->check($data);
if( $result != true) return $result; //errors
$profile->save();
```

Available Validators
--------------------

[](#available-validators)

- required `Ensures the specified key value exists and is not empty`
- email `Checks for a valid email address`
- max\_length,n `Checks key value length, makes sure it's not longer than the specified length. n = length parameter.`
- min\_length,n `Checks key value length, makes sure it's not shorter than the specified length. n = length parameter.`
- exact\_length,n `Ensures that the key value length precisely matches the specified length. n = length parameter.`
- alpha `Ensure only alpha characters are present in the key value (a-z, A-Z)`
- alpha\_numeric `Ensure only alpha-numeric characters are present in the key value (a-z, A-Z, 0-9)`
- numeric `Ensure only numeric key values`
- boolean `Checks for PHP accepted boolean values, returns TRUE for "1", "true", "on" and "yes"`
- url `Check for valid URL or subdomain`
- ipv4 `Check for valid IPv4 address`
- ipv6 `Check for valid IPv6 address`
- card `Check for a valid credit card number (Uses the MOD10 Checksum Algorithm)`
- phone `Validate phone numbers that match the following examples: 555-555-5555 , 5555425555, 555 555 5555, 1(519) 555-4444, 1 (519) 555-4422, 1-555-555-5555`
- regex `You can pass a custom regex using the following format: 'regex,/your-regex/'`

Adding custom validators and filters is made easy by using callback functions.

```
$message = "The value of {0} must include each of these items : {1}";
Validate::addValidator("contains", function ($value, $ruleConfigs) {
  $required = explode("&", substr($ruleConfigs[0], 1, -1));
  $diff = array_diff($required, explode(",", $value));
  return empty($diff);
 }, $message);

 //Or
Validate::addValidator("custom", "SampleClass::testCustom", "Custom Error");
```

RoadMap
-------

[](#roadmap)

- Add Tests and Travis
- Convert to Trait
- Use Audit and make Lib more lightweight
- Allow Translations
- Add Composer
- Add detailed Examples

Development
-----------

[](#development)

Tests are run using PHPUnit

```
./vendor/bin/phpunit --bootstrap vendor/autoload.php --testdox tests
```

Examples
--------

[](#examples)

See the tests folder for now

Contributing
------------

[](#contributing)

Feel free to Create a PR

###  Health Score

33

↑

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 84.6% 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

2804d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13bbbe90f1902d6dbc818338a1d6471c9380545cfdf8171d5440c907cc4035a1?d=identicon)[acemureithi](/maintainers/acemureithi)

---

Top Contributors

[![geofmureithi](https://avatars.githubusercontent.com/u/95377562?v=4)](https://github.com/geofmureithi "geofmureithi (22 commits)")[![kumy](https://avatars.githubusercontent.com/u/176794?v=4)](https://github.com/kumy "kumy (3 commits)")[![nimah79](https://avatars.githubusercontent.com/u/20343056?v=4)](https://github.com/nimah79 "nimah79 (1 commits)")

---

Tags

fat-free-framework

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geofmureithi-f3-validate/health.svg)

```
[![Health](https://phpackages.com/badges/geofmureithi-f3-validate/health.svg)](https://phpackages.com/packages/geofmureithi-f3-validate)
```

###  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)
