Download the PHP package ionepub/region without Composer

On this page you can find all versions of the php package ionepub/region. 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 region

region

Latest Stable Version

Total Downloads

Latest Unstable Version

License

A Chinese region search helper.

中国地区信息查询辅助类。根据国家统计局统计用区划代码查询地区信息,目前数据最小单位为街道、乡镇,支持编号查询/所在省市区查询/下级查询/中文搜索。

Requirement 依赖

安装

tip

如果 composer require ionepub/region 时报错:

需要先执行一次 composer update nothing,再执行require命令就可以了

由于region包依赖于Medoo,安装同时也会安装Medoo

使用

引用

示例

返回值示例:

首次初始化

首次初始化时,需向init静态方法传递第三个参数为true,此时将使用内置的sql文件向MySQL数据库中创建名为 $table_name 的表,并导入所有地区数据。首次初始化时,可能耗时较长。

当数据库中已有此表时,即使第三个参数为true,也不会再次初始化。

表结构如下:

获取实例

无论第三个参数是否为true,init()都将返回一个Region实例。

公共常量

获取省份列表

获取单个地区信息

获取多个地区信息

获取子级地区信息

child方法第二个参数接收地区层级参数,表示想要获取的子地区层级,默认为第一个参数所在层级的下一级,一般不使用

获取地区所在位置

position方法同样支持地区ID和地区编码传入,如市则返回省市,区则返回省市区。返回的数据按层级增序排序,包含参数所在地区。

按地区名称搜索

search方法接收3个参数:

License

MIT license.


All versions of region with dependencies

PHP Build Version
Package Version
Requires catfan/medoo Version >=1.5
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 ionepub/region contains the following files

Loading the files please wait ....