Elixir package for validating Spanish Phone numbers
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib
test
.DS_Store
.formatter.exs
.gitignore
README.md
mix.exs
mix.lock

README.md

ElixirSpainPhone

Elixir package for validating Spanish Phone numbers for length, format, and type. Also finds province for valid landlines.
Available Methods:

phone_number = '937226615'

ElixirSpainPhone.find_province(phone_number)
[:barcelona]

ElixirSpainPhone.valid?(phone_number)
true

ElixirSpainPhone.phone_type(phone_number)
"landline"

The PhoneGenerator module can be used to generate random, valid Spanish phone numbers. After requiring the module call:

PhoneGenerator.generate(:toll_free)
"800229664"

PhoneGenerator.generate(:premium)
"902293916"

PhoneGenerator.generate(:mobile)
"651715399"

PhoneGenerator.generate(:landline)
"951487492"

Installation

If available in Hex, the package can be installed by adding elixir_spain_phone to your list of dependencies in mix.exs:

def deps do
  [
    {:elixir_spain_phone, "~> 0.1.0"}
  ]
end