Dingo Framework

Dingo is a Rapid Development Application Framework written in PHP. Dingo allows you to create dynamic changing websites easily and quickly.

Validation Library

Overview

The Validation helper is designed to help with validating certain common types of data. To load the URL helper manually you may do this:

load::library('validate');

Email

Returns TRUE or FALSE based on if the given email address is valid. If you wanted to see if the email address joemomma@gmail.com was a valid one then you would do this:

// this will display 'Valid!'
if(valid::email('joemomma@gmail.com'))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

Phone

Returns TRUE or FALSE based on if the given 10 digit phone number is valid. If you wanted to see if the number (555) 245-2078 was a valid one then you would do this:

// This will display 'Valid!'
if(valid::phone('(555) 245-2078'))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

If you set the optional second argument to TRUE then the function will accept only numbers in the input (no spaces, '()', or '-').

// This will display 'Not Valid!'
if(valid::phone('(555) 245-2078',TRUE))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}
// This will display 'Valid!'
if(valid::phone(5552452078,TRUE))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

Username

Returns TRUE or FALSE based on if the given username is valid. If you wanted to see if the username ETbyrne1 was a valid one then you would do this:

// This will display 'Valid!'
if(valid::username('ETbyrne1'))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}
// This will display 'Not Valid!'
if(valid::username('ETbyrne#1'))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

Name

Returns TRUE or FALSE based on if the given English name is valid. If you wanted to see if the name Evan Byrne was a valid one then you would do this:

// This will display 'Valid!'
if(valid::name('Evan Byrne'))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}
// This will display 'Not Valid!'
if(valid::name('Evan_Byrne'))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

Number

Returns TRUE or FALSE based on if the given value is a number.

// This will display 'Valid!'
if(valid::number(123.4))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

Int

Returns TRUE or FALSE based on if the given value is an integer.

// This will display 'Not Valid!'
if(valid::int(123.4))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

Range

Returns TRUE or FALSE based on if the given number is within the specified range.

$number = 4;

// This will display 'Valid!'
if(valid::range(1,4,$number))
{
    echo 'Valid!';
}
else
{
    echo 'Not Valid!';
}

© 2008 - 2010 Evan Byrne