EU VAT number validator

Discussion in 'Coding, Scripting & Programming' started by SentinelTower, Jan 9, 2015.

Tags:
  1. SentinelTower

    SentinelTower New Member

    41
    17
    Nov 25, 2014
    Hi all,

    I have written a PHP class to validate Eu VAT Numbers. It queries the VIES SOAP API and validates the format beforehand.

    There is a set of regular expressions to validate the number and it would be great if companies with a valid EU VAT number could check if their number is correctly validated.

    The project is here : https://github.com/suikatech/EuVatValidator

    It runs on PHP, and you can use the demo file to validate your number using the form included.

    Please tell your country in your feedbacks.

    Thanks !
     
  2. HalfEatenPie

    HalfEatenPie The Irrational One Retired Staff

    2,890
    1,386
    Mar 25, 2013
    HalfEatenPie
    Looks great!  

    Out of curiosity, possible to make this into something like a WHMCS extension for easy integration?  
     
  3. William

    William pr0 Verified Provider

    440
    191
    Oct 10, 2013
    What is 'EL'? No such country code.

    case "EL": if (preg_match("/^EL[0-9]{9}/", $vatNumberFull) != 1) { return false; } break;
     
    Last edited by a moderator: Jan 9, 2015
  4. vld

    vld New Member Verified Provider

    30
    27
    May 17, 2013
    Greece
     
  5. rds100

    rds100 New Member Verified Provider

    733
    300
    May 18, 2013
    ELlada ;-)
     
  6. William

    William pr0 Verified Provider

    440
    191
    Oct 10, 2013
    Strange Greeks can't even use their own country code... weird
     
  7. zafouhar

    zafouhar Member

    92
    42
    Jun 30, 2013
    The country code for Greece is EL as far as I am aware
     
    Last edited by a moderator: Jan 10, 2015
  8. William

    William pr0 Verified Provider

    440
    191
    Oct 10, 2013
    No, the ISO code is GR.
     
  9. DomainBop

    DomainBop Dormant VPSB Pathogen

    2,260
    2,190
    Oct 11, 2013
     EL is the ISO alpha-2 language code for the Greek language (alpha-3 is ELL)

    ISO country code is GR (alpha-2) or GRC (alpha-3)
     
    Last edited by a moderator: Jan 11, 2015
  10. SentinelTower

    SentinelTower New Member

    41
    17
    Nov 25, 2014
    I have not worked with WHMCS, so I do not know how hard it would be. However, the class is plain PHP, it should be easy to reuse and to integrate.

    About "EL", yup this is for greece. The format of the EU VAT Numbers is described here : http://ec.europa.eu/taxation_customs/vies/faq.html?locale=en#item_11