Yii 1.1: urivalidator

URI Validator
1 follower

EUriValidator is a validator which uses regular expresions and other checks to validate an URI according to RFC 3986 and related RFCs, and see if it is well formed.

Current version: 1.0

File checksums:

3eebb387157ae23271c3b0b860e91469 urivalidator-1.0.tar.gz

c490fb782b1c793c66eafedbc2beb588 urivalidator-1.0.zip

Resources

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract the release file under protected/extensions

Usage

In the model:

public $uri;
 
public function rules()
{
   return array(
               array('uri', 'application.extensions.urivalidator.EUriValidator', 'mode'=>'web')
               );
}

Configuration parameters

/**
    * The validation can:
    * 
    * - uri: check if an URI is well formed, as far and strictly as possible.
    * - web: check if an URI is well formed, real world WWW URI (http or https).
    * - mail: check if an URI is well formed, real world mailto: URI.
    *
    * @var string
    */
   private $mode = 'uri';
 
   /**
    * Whetever to allow empty URIs
    *
    * @var boolean
    */
   private $allowEmptyURI = true;
 
   /**
    * Should we validate the schema against the IANA registered schemas?
    *
    * @var boolean
    */
   private $validateIANA = true;
 
   /**
    * Should we validate if the port is between 0 and 65535?
    *
    * @var boolean
    */
   private $validatePortRange = true;
 
   /**
    * The user can define which schemes are valid,
    * for example array('http','ftp')
    *
    * @var array of string
    */
   private $customSchemes = array();
 
   /**
    * The user can define which ports are valid,
    * for example array(80,21)
    *
    * @var array of integer
    */
   private $customPorts = array();

Change Log

December 28, 2008

  • Version 1.0: Initial release.

Total 1 comment

#737 report it
Orteko at 2010/03/09 01:23am
Works fine.

Works great for me and more fully featured than the inbuilt validator.

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: MetaYii
  • Category: Validation
  • Votes: +2
  • Downloaded: 942 times
  • Created on: Dec 28, 2008
  • Last updated: Dec 28, 2008