ZendFramework2その5

入力チェック、Validatorについて書いていきます。
ZF2にあらかじめ用意されているValidatorは84個あるみたいです。

No 略名 クラス名
1 ‘alnum’ ‘Zend\I18n\Validator\Alnum’
2 ‘alpha’ ‘Zend\I18n\Validator\Alpha’
3 ‘barcodecode25interleaved’ed’ ‘Zend\Validator\Barcode\Code25interleav’
4 ‘barcodecode25’ ‘Zend\Validator\Barcode\Code25’
5 ‘barcodecode39ext’ ‘Zend\Validator\Barcode\Code39ext’
6 ‘barcodecode39’ ‘Zend\Validator\Barcode\Code39’
7 ‘barcodecode93ext’ ‘Zend\Validator\Barcode\Code93ext’
8 ‘barcodecode93’ ‘Zend\Validator\Barcode\Code93’
9 ‘barcodeean12’ ‘Zend\Validator\Barcode\Ean12’
10 ‘barcodeean13’ ‘Zend\Validator\Barcode\Ean13’
11 ‘barcodeean14’ ‘Zend\Validator\Barcode\Ean14’
12 ‘barcodeean18’ ‘Zend\Validator\Barcode\Ean18’
13 ‘barcodeean2’ ‘Zend\Validator\Barcode\Ean2’
14 ‘barcodeean5’ ‘Zend\Validator\Barcode\Ean5’
15 ‘barcodeean8’ ‘Zend\Validator\Barcode\Ean8’
16 ‘barcodegtin12’ ‘Zend\Validator\Barcode\Gtin12’
17 ‘barcodegtin13’ ‘Zend\Validator\Barcode\Gtin13’
18 ‘barcodegtin14’ ‘Zend\Validator\Barcode\Gtin14’
19 ‘barcodeidentcode’ ‘Zend\Validator\Barcode\Identcode’
20 ‘barcodeintelligentmail’ ‘Zend\Validator\Barcode\Intelligentmail’
21 ‘barcodeissn’ ‘Zend\Validator\Barcode\Issn’
22 ‘barcodeitf14’ ‘Zend\Validator\Barcode\Itf14’
23 ‘barcodeleitcode’ ‘Zend\Validator\Barcode\Leitcode’
24 ‘barcodeplanet’ ‘Zend\Validator\Barcode\Planet’
25 ‘barcodepostnet’ ‘Zend\Validator\Barcode\Postnet’
26 ‘barcoderoyalmail’ ‘Zend\Validator\Barcode\Royalmail’
27 ‘barcodesscc’ ‘Zend\Validator\Barcode\Sscc’
28 ‘barcodeupca’ ‘Zend\Validator\Barcode\Upca’
29 ‘barcodeupce’ ‘Zend\Validator\Barcode\Upce’
30 ‘barcode’ ‘Zend\Validator\Barcode’
31 ‘between’ ‘Zend\Validator\Between’
32 ‘callback’ ‘Zend\Validator\Callback’
33 ‘creditcard’ ‘Zend\Validator\CreditCard’
34 ‘csrf’ ‘Zend\Validator\Csrf’
35 ‘date’ ‘Zend\Validator\Date’
36 ‘datestep’ ‘Zend\Validator\DateStep’
37 ‘datetime’ ‘Zend\I18n\Validator\DateTime’
38 ‘dbnorecordexists’ ‘Zend\Validator\Db\NoRecordExists’
39 ‘dbrecordexists’ ‘Zend\Validator\Db\RecordExists’
40 ‘digits’ ‘Zend\Validator\Digits’
41 ‘emailaddress’ ‘Zend\Validator\EmailAddress’
42 ‘explode’ ‘Zend\Validator\Explode’
43 ‘filecount’ ‘Zend\Validator\File\Count’
44 ‘filecrc32’ ‘Zend\Validator\File\Crc32’
45 ‘fileexcludeextension’ ‘Zend\Validator\File\ExcludeExtension’
46 ‘fileexcludemimetype’ ‘Zend\Validator\File\ExcludeMimeType’
47 ‘fileexists’ ‘Zend\Validator\File\Exists’
48 ‘fileextension’ ‘Zend\Validator\File\Extension’
49 ‘filefilessize’ ‘Zend\Validator\File\FilesSize’
50 ‘filehash’ ‘Zend\Validator\File\Hash’
51 ‘fileimagesize’ ‘Zend\Validator\File\ImageSize’
52 ‘fileiscompressed’ ‘Zend\Validator\File\IsCompressed’
53 ‘fileisimage’ ‘Zend\Validator\File\IsImage’
54 ‘filemd5’ ‘Zend\Validator\File\Md5’
55 ‘filemimetype’ ‘Zend\Validator\File\MimeType’
56 ‘filenotexists’ ‘Zend\Validator\File\NotExists’
57 ‘filesha1’ ‘Zend\Validator\File\Sha1’
58 ‘filesize’ ‘Zend\Validator\File\Size’
59 ‘fileupload’ ‘Zend\Validator\File\Upload’
60 ‘fileuploadfile’ ‘Zend\Validator\File\UploadFile’
61 ‘filewordcount’ ‘Zend\Validator\File\WordCount’
62 ‘float’ ‘Zend\I18n\Validator\Float’
63 ‘greaterthan’ ‘Zend\Validator\GreaterThan’
64 ‘hex’ ‘Zend\Validator\Hex’
65 ‘hostname’ ‘Zend\Validator\Hostname’
66 ‘iban’ ‘Zend\Validator\Iban’
67 ‘identical’ ‘Zend\Validator\Identical’
68 ‘inarray’ ‘Zend\Validator\InArray’
69 ‘int’ ‘Zend\I18n\Validator\Int’
70 ‘ip’ ‘Zend\Validator\Ip’
71 ‘isbn’ ‘Zend\Validator\Isbn’
72 ‘isinstanceof’ ‘Zend\Validator\IsInstanceOf’
73 ‘lessthan’ ‘Zend\Validator\LessThan’
74 ‘notempty’ ‘Zend\Validator\NotEmpty’
75 ‘phonenumber’ ‘Zend\I18n\Validator\PhoneNumber’
76 ‘postcode’ ‘Zend\I18n\Validator\PostCode’
77 ‘regex’ ‘Zend\Validator\Regex’
78 ‘sitemapchangefreq’ ‘Zend\Validator\Sitemap\Changefreq’
79 ‘sitemaplastmod’ ‘Zend\Validator\Sitemap\Lastmod’
80 ‘sitemaploc’ ‘Zend\Validator\Sitemap\Loc’
81 ‘sitemappriority’ ‘Zend\Validator\Sitemap\Priority’
82 ‘stringlength’ ‘Zend\Validator\StringLength’
83 ‘step’ ‘Zend\Validator\Step’
84 ‘uri’ ‘Zend\Validator\Uri’

一般的な使い方をしたいときはこんな感じで使えると思う。

詳しい使い方は↓を見てください。
http://framework.zend.com/manual/2.0/en/modules/zend.validator.set.html)”:http://framework.zend.com/manual/2.0/en/modules/zend.validator.set.html


コメントを残す