Download the PHP package hejunjie/mobile-locator without Composer

On this page you can find all versions of the php package hejunjie/mobile-locator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mobile-locator

hejunjie/mobile-locator

English | 简体中文

A mobile phone number location lookup library based on Chinese number segment rules. Supports carrier and region identification, suitable for registration validation, user profiling, and data archiving.

PHP Version

Number segments included: 483,709

This project has been parsed by Zread. Click here for a quick overview: Understand this project

Features

Requirements

Installation

Quick Start

API

getCarrierInfo(string $phoneNumber, string $returnUnknown = '未知'): array

Queries carrier and location information for a given phone number.

Parameter Type Description
$phoneNumber string Phone number, must be numeric with at least 7 digits
$returnUnknown string Default value returned when no match is found, defaults to '未知'

Return value:

When no match is found, all three fields return the value of $returnUnknown.

Exceptions:

Implementation: Uses the singleton pattern internally, with query results cached in memory. Repeated queries for the same number within a single process will not trigger redundant file reads.

getData(): array

Returns the full dataset of all number segments.

[!WARNING] The data file is approximately 49MB, and decoding can consume 200–500MB of memory. The method sets memory_limit to 1024M internally. For production use, consider importing the data into an external cache such as Redis via this method.

Data Files

The project includes two types of data files:

File Description
src/data.json Full dataset (~49MB), containing all number segments
src/carrier_data_{prefix}.json Sharded files split by the first 3 digits, 56 files in total

Data format:

Each segment (first 7 digits of a phone number) maps to a record containing province, city, and carrier information.

Performance Tips

The getCarrierInfo() method provides basic on-demand loading and in-memory caching, sufficient for low-frequency lookup scenarios. For higher performance requirements (high concurrency, batch queries), we recommend:

  1. Cache the full dataset in Redis: Use getData() to retrieve all data and import it into Redis, then query directly from Redis
  2. Implement your own batch lookup: For bulk phone number queries, preload the relevant segment files and perform batch matching to avoid repeated I/O overhead

Updates & Contributing

Number segment data is updated periodically. If you find missing or inaccurate data, feel free to open an Issue or PR.


All versions of mobile-locator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hejunjie/mobile-locator contains the following files

Loading the files please wait ...