All Projects → ianks → Mini_phone

ianks / Mini_phone

Licence: mit
A fast phone number lib for Ruby (binds to Google's C++ libphonenumber)

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Mini phone

Phone
With a given country and phone number, validate and reformat the mobile phone number to the E.164 standard. The purpose of this is to allow us to send SMS to mobile phones only.
Stars: ✭ 531 (+305.34%)
Mutual labels:  phone, phone-number
Moriarty Project
This tool gives information about the phone number that you entered.
Stars: ✭ 223 (+70.23%)
Mutual labels:  phone, phone-number
Phonia
Phonia Toolkit is one of the most advanced toolkits to scan phone numbers using only free resources. The goal is to first gather standard information such as country, area, carrier and line type on any international phone numbers with a very good accuracy.
Stars: ✭ 221 (+68.7%)
Mutual labels:  phone, phone-number
PhoneNumberKit
Android Kotlin library to parse and format international phone numbers. Country code picker.
Stars: ✭ 124 (-5.34%)
Mutual labels:  phone-number, phone
Vue Phone Number Input
A phone number input made with Vue JS (format & valid phone number)
Stars: ✭ 407 (+210.69%)
Mutual labels:  phone, phone-number
haoma
手机固话电话号码标记批量查询📞📌
Stars: ✭ 52 (-60.31%)
Mutual labels:  phone-number, phone
getcontact
Find info about user by phone number using GetContact API
Stars: ✭ 228 (+74.05%)
Mutual labels:  phone-number, phone
Phoneinfoga
PhoneInfoga is one of the most advanced tools to scan international phone numbers using only free resources. It allows you to first gather standard information such as country, area, carrier and line type on any international phone number. Then search for footprints on search engines to try to find the VoIP provider or identify the owner.
Stars: ✭ 5,927 (+4424.43%)
Mutual labels:  phone, phone-number
Crboxinputview
Verify code input view. Support security type for password.短信验证码输入框,支持密文模式
Stars: ✭ 749 (+471.76%)
Mutual labels:  phone, phone-number
Arg.js
🇦🇷 🛠 NPM library. Validation of Argentinian bank account numbers, IDs and phone numbers
Stars: ✭ 52 (-60.31%)
Mutual labels:  phone
Pixelbot
Stars: ✭ 90 (-31.3%)
Mutual labels:  phone
Numpad
Numpad is light weight library for multipurpose usage in numaric input
Stars: ✭ 44 (-66.41%)
Mutual labels:  phone-number
Cn Mobile Location
中国手机号码归属地接口
Stars: ✭ 53 (-59.54%)
Mutual labels:  phone
Libgen Scan
Scan a barcode; get a book! Easy-peasy.
Stars: ✭ 91 (-30.53%)
Mutual labels:  phone
Brazilian Utils
Utils library for specific Brazilian businesses
Stars: ✭ 1,023 (+680.92%)
Mutual labels:  phone
Xiaoai
a tiny&smart AI & Repo for work for AI Survey百度云资源持续更新中,欢迎点赞star Min's blog 欢迎访问我的博客主页!(Welcome to my blog website !)https://liweimin1996.github.io/
Stars: ✭ 111 (-15.27%)
Mutual labels:  phone
Google Libphonenumber
The up-to-date and reliable Google's libphonenumber package for node.js.
Stars: ✭ 984 (+651.15%)
Mutual labels:  phone
Authy
Rinvex Authy is a simple wrapper for @Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.
Stars: ✭ 34 (-74.05%)
Mutual labels:  phone
Laravel Phone
Phone number functionality for Laravel
Stars: ✭ 1,806 (+1278.63%)
Mutual labels:  phone
Edk2 Sdm845
(Maybe) Generic edk2 port for sdm845
Stars: ✭ 84 (-35.88%)
Mutual labels:  phone

MiniPhone

A Ruby gem which plugs directly into Google's native C++ libphonenumber for extremely fast and robust phone number parsing, validation, and formatting. On average, most methods are 70x to 80x faster than other Ruby phone number libraries.

Usage

Checking if a phone number is valid

MiniPhone.valid?('+14043841399')                     # true
MiniPhone.valid_for_country?('(404) 384-1399', 'US') # true
MiniPhone.valid_for_country?('(404) 384-1399', 'GB') # false

Formatting a number

MiniPhone.default_country = 'US'

phone_number = MiniPhone.parse('404-384-1399')

phone_number.e164                 # +14043841399
phone_number.national             # (404) 384-1399
phone_number.raw_national         # 4043841399
phone_number.dasherized_national  # 404-384-1399
phone_number.international        # +1 404-384-1399
phone_number.rfc3966              # tel:+1-404-384-1384

Checking if a phone number is possible

phone_number = MiniPhone.parse('-12')

phone_number.possible? # false

Getting the type of a phone number

MiniPhone.parse('+12423570000').type # :mobile
MiniPhone.parse('+12423651234').type # :fixed_line

The possible types are directly mapped from this enum:

:fixed_line
:mobile
:fixed_line_or_mobile
:toll_free
:premium_rate
:shared_cost
:voip
:personal_number
:pager
:uan
:voicemail
:unknown

Compatibility with PhoneLib

MiniPhone aims to be compatible with Phonelib. In many cases it can be a drop in replacement. It has a smaller feature set, so it is not a replacement for every use case. If there is a feature you need, open an issue and we will try to support it.

Benchmarks

On average, most methods are 40x to 50x faster than other libraries. To run the benchmarks locally, execute: bundle exec rake bench

Results from my Linux (5.10.6-arch1-10)

Comparison:
   MiniPhone:    valid?:    33382.0 i/s
    Phonelib:    valid?:      422.8 i/s - 78.95x  (± 0.00) slower
TelephoneNumber: valid?:      164.3 i/s - 203.13x  (± 0.00) slower

Comparison:
     MiniPhone:  e164:    41187.5 i/s
      Phonelib:  e164:      579.0 i/s - 71.14x  (± 0.00) slower
TelephoneNumber: e164:      228.8 i/s - 179.99x  (± 0.00) slower

Installation

  1. Install libphonenumber

    brew install libphonenumber # mac
    
    apt-get install -y libphonenumber-dev # debian / ubuntu
    
  2. Add this line to your application's Gemfile:

    gem 'mini_phone'
    
  3. And then execute:

    bundle install
    

    Or install it yourself as:

    gem install mini_phone
    

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ianks/mini_phone. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the MiniPhone project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].