Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnvuko/validates_phone_format_of
Validate phone numbers against E.164 format with this Ruby on Rails gem.
https://github.com/johnvuko/validates_phone_format_of
e164 phone phone-number rails ruby validate validator
Last synced: about 2 months ago
JSON representation
Validate phone numbers against E.164 format with this Ruby on Rails gem.
- Host: GitHub
- URL: https://github.com/johnvuko/validates_phone_format_of
- Owner: johnvuko
- License: mit
- Created: 2017-01-31T15:12:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-18T20:17:13.000Z (almost 2 years ago)
- Last Synced: 2024-10-08T09:44:47.402Z (3 months ago)
- Topics: e164, phone, phone-number, rails, ruby, validate, validator
- Language: Ruby
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# validates_phone_format_of
[![CI Status](http://img.shields.io/travis/jonathantribouharet/validates_phone_format_of.svg)](https://travis-ci.org/jonathantribouharet/validates_phone_format_of)
[![Gem Version](https://badge.fury.io/rb/validates_phone_format_of.svg)](http://badge.fury.io/rb/validates_phone_format_of)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
```ruby
class User < ActiveRecord::Basevalidates :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
- [intl-tel-input](https://github.com/jackocnr/intl-tel-input) Javascript library forcing users to set the region
- [global_phone](https://github.com/sstephenson/global_phone)## Author
- [Jonathan VUKOVICH-TRIBOUHARET](https://github.com/jonathantribouharet) ([@johnvuko](https://twitter.com/johnvuko))
## License
This project is released under the MIT license. See the LICENSE file for more info.