Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Validate_Phone Component Proposal

Proposed Component Name Zend_Validate_Phone
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Validate_Phone
Proposers Thomas Weidner
Zend Liaison TBD
Revision 1.0 - 11 June 2009: Initial Draft. (wiki revision: 5)

Table of Contents

1. Overview

Zend_Validate_Phone is a validator which checks if a given input conforms a expected format for a phone number.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will check if a string conforms a expected phone number format
  • This component will not change the format, only check
  • This component will accept national and international formats
  • This component will also allow to check if a given number conforms a given country or multiple countries
  • This component will not check if a given number does exist

4. Dependencies on Other Framework Components

  • Zend_Validate_Exception
  • Zend_Validate_Abstract

5. Theory of Operation

The component validates if a given string conforms a expected input. The expected format can be a national number, a international number, or a self defined format. It can also check if number parts are given. (country code, extension).

6. Milestones / Tasks

  • Milestone 1: [DONE] Proposal finished
  • Milestone 2: Proposal accepted
  • Milestone 3: Working implementation
  • Milestone 4: Unit tests
  • Milestone 5: Documentation
  • Milestone 6: Moved to core

7. Class Index

  • Zend_Validate_Phone

8. Use Cases

UC-01

Simply validation... accepts all sorts of phone numbers

UC-02

Validation for one country

UC-02

Validation with set options (no extension)

UC-03

Validation with set options (national format)

UC-04

Validation with self defined format

The resulting number would be like
Territory code: 4 numbers
City code: 3 numbers
Local code: 5 to 7 numbers
Extension: 0 numbers

+49 1234 456789 -> false -> territory code 2 and not 4
0049 (1234) 456789 -> true
0049 (1234) 456789-123 -> false, extension given

9. Class Skeletons

]]></ac:plain-text-body></ac:macro>

]]></ac:plain-text-body></ac:macro>

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jul 07, 2009

    <p>I build a custom validator for Dutch phone numbers. It checks:</p>
    <ul class="alternate">
    <li>area code / prefix existence based on official number plan</li>
    <li>length (depends on prefix)</li>
    <li>sanity checks in local code (some digits are not allowed as first digit, depends on prefix)</li>
    <li>can check for certain types: regular, service number (0800,090x), mobile (06), data/ISP (06760)</li>
    </ul>

    <p>The last check can be helpfull in a number of ways, since a fax number would never be a mobile or service number, a private person wouldn't have a service number and an office would probably not have a mobile number as an office number. </p>

    <p>I don't know how common this is for number plans in other countries. I suppose that for this level of detail, you'd need a per country adapter for this validator.</p>

    <p>Also, the data used for the validator is also used for a filter that formats a number properly. It needs the prefix list for this (we have variable prefix length).</p>

    1. Jul 08, 2009

      <p>Some points to mention:</p>

      <ul>
      <li>This proposal is until now not accepted</li>
      <li>There is no official number plan for all countries</li>
      <li>Length does not only depend on prefix but also on extension and notation</li>
      <li>There is no official list for service, mobile or data numbers... many countries have no number plan which seperate these... fax and data numbers are often only seperated by extension (fax -550, phone -500) so there would be no way to validate this properly</li>
      <li>I planed also to add a filter, but another guy added a proposal for it which lacks some points in my eyes... I'm not sure if I want/have to add my own as my other proposals are until now not reviewed by the dev team.</li>
      </ul>

  2. Jul 14, 2009

    <ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Framework Approval</ac:parameter><ac:rich-text-body>
    <p>This proposal is accepted for immediate development in the standard incubator, as-is.</p></ac:rich-text-body></ac:macro>

  3. Aug 04, 2009

    <p>When we can see a first version in the incubator ?</p>

  4. Aug 22, 2012

    <p>What's the status of this proposal? Thomas Weidner is respectable authority for his locale work, so he's probably the best person for the job. Is this proposal discontinued in favor of something else? We run into a problem with phone validation with one of our international customers and our validator works only for small subset of numbers...</p>