8000 GitHub - jony741/GUMP at v2
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ GUMP Public
forked from Wixel/GUMP

A fast, extensible & stand-alone PHP input validation class that allows you to validate any data

License

Notifications You must be signed in to change notification settings

jony741/GUMP

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting started

GUMP is a light-weight, dependency-free validation class for PHP 7+. The aim is to make data validation and filtering as painless as possible while being easily extendible to fit any project with or without a framework.

v2.0 is a complete rewrite of the original and is therefore not backwards compatible.

Install with composer

Add the following to your composer.json file:

{
    "require": {
        "wixel/gump": "dev-master"
    }
}

To install the older version on GUMP, please use:

{
    "require": {
        "wixel/gump": "1.5.6"
    }
}

Quick Start Overview

require 'gump.class.php';

# Load any language files
GUMP::load_lang('lang/en.yaml');

# Manually create a validator or filter function
GUMP::register('required', function($value, $params = null) { 
	$value = trim($value);

	if(!empty($value)) {
		return $value;
	} else {
		throw new Exception("Value is required");
	}
});


# Get or set config value (accesible inside GUMP functions)
GUMP::config('key', 'value');

# Call an individual GUMP method
$value = GUMP::call('method', $value, $params);

# Override a field with a custom field name
GUMP::set_field_name('key', 'Field Name');

$input = array(
	'name' => 'A Name',
	'email' => 'test@test.com'
);

$result = GUMP::run($input, array(
	'name' => 'required',
	'email' => 'valid_email'
));

if($result->valid()) {
	$result->fields();
} else {
	$result->errors('en');
}

TODO

  • Donations button
  • Virtual Machine
  • Available languages
  • Contribution guide & quality control
  • PHP Unit Tests
  • Readme
    • Quick start overview
    • Installing
    • Creating validators
    • Creating filters
    • Using results
    • Calling singular methods
    • Adding languages
    • Available validators
    • Available filters
    • Setting configs
    • Setting custom field names
    • Running Examples (+ VM)
    • Running Tests
    • Add: strong password validator

About

A fast, extensible & stand-alone PHP input validation class that allows you to validate any data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%
0