sharapov/zend-validator

A batch of additional validators for zend framework (https://framework.zend.com)

dev-master 2018-03-24 13:07 UTC

This package is not auto-updated.

Last update: 2020-03-20 17:47:36 UTC


README

A batch of additional validators for zend framework (https://framework.zend.com)

Attention!

The project is deprecated and not supported anymore. Use https://github.com/sharapov-outsource/zend-extensions instead.

Installation (via Composer):

For composer installation, add:

"require": {
    "sharapov/zend-validator": "dev-master"
},

to your composer.json file and update your dependencies. Or you can run:

$ composer require sharapov/zend-validator

Usage:

Now you can autoload or use the class via its namespace. Below are examples of how to use the library.

GoogleAnalytics tracking number validator

require_once dirname(__FILE__) . '/../vendor/autoload.php';

$gaValidator = new \Sharapov\ZendValidator\GoogleAnalytic();
$gaTrackingNumber = 'UA-15617169-12';

if($gaValidator->isValid($gaTrackingNumber)) {
  print 'Valid';
} else {
  print 'Not valid';
}

AlnumDash validator


$AlnumDash = new \Sharapov\ZendValidator\I18n\AlnumDash();
$string = 'The string contains spaces-dashes_and_underscores';
$AlnumDash
  ->setAllowDashes(true)
  ->setAllowUnderscores(true)
  ->setAllowWhiteSpace(true);
if($AlnumDash->isValid($string)) {
  print 'Valid';
} else {
  print 'Not valid';
}

You will find other examples in "/examples" folder.

Changelog

Links

ZendFramework

Composer

GitHub

Packagist