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_Filter_Phone Component Proposal

Proposed Component Name Zend_Filter_Phone
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Filter_Phone
Proposers Thomas Weidner
Zend Liaison TBD
Revision 1.0 - 29 November 2009: Initial Draft. (wiki revision: 6)

Table of Contents

1. Overview

Zend_Filter_Phone is a filter which converts numeric input to a phone number.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will convert numeric input to conform a specified phone number format.
  • This component will support national and international formats.
  • This component will support definition of propritary formats.
  • This component will provide and use the same API as Zend_Validate_Phone

4. Dependencies on Other Framework Components

  • Zend_Filter
  • Zend_Filter_Exception

5. Theory of Operation

This components changes a given input so it conforms a given phone number format. You could give a number and convert it into an international format or a national format simply by changing one spezifier. You could also seperate the different number tokens of which a phone number consists.

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_Filter_Phone

8. Use Cases

UC-01
UC-02
UC-03

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. Dec 01, 2009

    <p>Much needed!</p>

  2. Jul 20, 2010

    <p>I was coming now to add a new proposal for Zend_Locale_Phone and found this proposal while I was searching if someone already did submit one and I found this proposal. I don't know if what I was thinking about can be added to one of your Phone proposals or it can just be a new class [Zend_Locale_Phone]. so I need some guidance.</p>

    <p>I was thinking about a class than can </p>

    <p>- take a localized phone number and normalize it like converting +20 10 1234567 to 20101234567<br />
      the passed phone number could be of any kind of format<br />

    • take localized number and reformat it to a any chosen format<br />
    • take a phone number and try to get its country like taking +20 10 1234567 and returning EG.<br />
        I did already did work on this one and this was the start of my idea about the proposal<br />
    • return country code [ 1, 20 ] by locale [US, EG ..]<br />
    • return locale(s) by country code (this can be kind of tricky as countries like US & CA use the same country code [1] ).</p>

    <p>I don't know if these can make a new class or not, but anyway I will be glad to help with these classes under your lead. I'm working now in a telecommunication company on a project that all about phone numbers [mainly SMS], so this is what I do daily anyway.</p>

    <p>thanks </p>

    1. Jul 21, 2010

      <p>Interesting idea.</p>

      <p>The trouble with the same country code probably could be circumvented when taking the area code into account.<br />
      This I think would also be necessary when estimating locales for countries that use more than one locale as switzerland for instance where you would return fr_CH, de_CH, it_CH or rm_CH according to the area-code.</p>

      <p>Not sure whether that would work though.</p>

      1. Jul 21, 2010

        <p>Great, I don't know if there is an organization that can provide us with accurate and updated area codes for all countries, but anyway we still have <a href="http://en.wikipedia.org/wiki/Category:Telephone_numbers_by_country" title="Telephone numbers by country">the list provided by Wikipedia</a>.</p>

        <p>about countries with many locales, we can just use the second part [country/region] as the the first part is the [language] . so for Switzerland we will return [CH] without the language.</p>

        1. Jul 24, 2010

          <p>Area codes within a country are always declared by the country itself.<br />
          There is no international or other organisation which can provide this information.</p>

          <p>You can of course get a list from a provider (I have such data and access) but this information can never be complete as it's information which changes every month. Many countries don't even have an organisation where you can get such informations.</p>

          <p>Regarding locale and country: this is no problem in reallity.</p>

    2. Jul 24, 2010

      <p>Zend_Locale_Phone is already in progress. It is an extension on the provided data like the plural rules which are also locale data. There is no need to make an extra proposal for this additional data because Zend_Locale_Phone will not change numbers.</p>

      <p>Therefor this proposal has been added. But as this proposal has not beed accepted for now, I am also not working on it.</p>

      <p>In sum there are 3 components which are needed to work on phone numbers.<br />
      Zend_Locale which provides that needed number informations. No proposal needed.<br />
      Zend_Validator_Phone which validates phone numbers. Already accepted.<br />
      Zend_Filter_Phone which normalizes, localizes and changes phone numbers. Not accepted for now.</p>

      <p>When the last component has been accepted I am able to start my work. Until then you may have to wait.</p>

      <p>The information you described is a combination of Locale and Filter.</p>

      1. Jul 24, 2010

        <p>great work, this is all what I wanted to know. I will wait till the final proposal is accepted and will be glad to help with testing and reporting issues.</p>

        <p>regards</p>

  3. Jul 28, 2010

    <p>Can it also be used 'in reverse'? Meaning that when i input 1 (257) 12345 - 67 i get as result: 2571234567?</p>

    1. Jul 30, 2010

      <p>Not in all cases but normally yes.</p>

      <p>It would for example not be possible to revert your result to 1 (xxx) yyy again without knowing the country. Therefor the locale (region) is used in the above examples.</p>

  4. Jul 28, 2010

    <p>I know in the US there are many was to output a phone #. Is there a way to set custom format like ###<span style="text-decoration: line-through;">###</span>#### or (###) ###-#### or ###.###.#### etc..</p>

    <p>What about phone extensions?</p>

    1. Jul 30, 2010

      <p>As you can see in the above "usecase 3" extensions are supported.</p>

  5. Aug 03, 2010

    <ac:macro ac:name="note"><ac:rich-text-body><p><strong>Community Review Team Recommendation</strong></p>

    <p>The CR Team advises that this proposal be approved.</p></ac:rich-text-body></ac:macro>