Zambia Mobile Networks

Identify Zambian mobile networks (Airtel, MTN, Zamtel, Zed Mobile) from a phone number.

Prefixes

NetworkLocalWith country code (260)
Airtel097, 077, 05726097, 26077, 26057
MTN096, 076, 05626096, 26076, 26056
Zamtel095, 075, 05526095, 26075, 26055
Zed Mobile098, 078*, 058*26098, 26078*, 26058*

* 078/058 are reserved for Zed Mobile but not yet officially enabled by the network provider; they are detected pre-emptively.

Installation

Add zambia_mobile_networks to your deps in mix.exs:

def deps do
[
{:zambia_mobile_networks, "~> 0.1"}
]
end

Usage

ZambiaMobileNetworks.detect("0971234567") # :airtel
ZambiaMobileNetworks.detect("260761234567") # :mtn
ZambiaMobileNetworks.detect("+260 95 123 4567") # :zamtel
ZambiaMobileNetworks.detect("0911234567") # nil
ZambiaMobileNetworks.supports?("0961234567", :mtn) # true
ZambiaMobileNetworks.label(:zamtel) # "Zamtel"
ZambiaMobileNetworks.networks() # [:airtel, :mtn, :zamtel, :zed]
# Logos — bundled 200x200 PNG as a base64 data URI
ZambiaMobileNetworks.logo(:mtn) # "data:image/png;base64,..."
ZambiaMobileNetworks.logo(:mtn, "path/to/logo.png") # use your own (path or binary)

Test

mix test

License

This project is open-source and available under the terms of the MIT License.