/validates_phone_format_of

Validate phone numbers against E.164 format with this Ruby on Rails gem.

Primary LanguageRubyMIT LicenseMIT

validates_phone_format_of

CI Status Gem Version

Validate phone numbers against E.164 format.

Installation

validates_phone_format_of is distributed as a gem, which is how it should be used in your app.

Include the gem in your Gemfile:

gem 'validates_phone_format_of', '~> 3.0'

Usage

In your model

class User < ActiveRecord::Base

	validates :phone, phone_format: true
	# Or
	validates_phone_format_of :phone

	# Same thing as
	validates_format_of :phone, with: ValidatesPhoneFormatOf::Regexp
	# Or
	validates_format_of :phone, with: /\A\+\d{1,15}\z/

end

Others libraries useful

Author

License

This project is released under the MIT license. See the LICENSE file for more info.