Download the PHP package eclipxe/sepomexphp without Composer
On this page you can find all versions of the php package eclipxe/sepomexphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eclipxe/sepomexphp
More information about eclipxe/sepomexphp
Files in eclipxe/sepomexphp
Package sepomexphp
Short Description Servicio Postal Mexicano PHP Library (Unofficial)
License MIT
Homepage http://github/eclipxe13/sepomexphp
Informations about the package sepomexphp
eclipxe\sepomexphp - Servicio Postal Mexicano PHP Library
This library is an unofficial version for the Mexican SEPOMEX data.
Some parts of the project are in Spanish since the main consumers of this library are mexicans. Anyhow, all the database, code and other information is in english.
Installation
Install using composer, no other methods are recommended!
Usage
Using a Sqlite3 database file created by the library:
Using your own PDO connection:
Also, check the zipcode-info.php
script. And ZipCodeDataTest.php
test.
If you only want to download the source file from SEPOMEX, check script file scripts/download.php
.
It is possible to use your own downloader, just implement the interface DownloaderInterface
.
The project provides the following implementations:
SymfonyDownloader
: It uses Symfony Browser Kit to perform the download (recommended).GuzzleDownloader
: Uses Guzzle and fixed data to perform the download.PhpStreamsDownloader
: Uses plain PHP functions and fixed data to perform the download.
If you want to import the source file from SEPOMEX into your own SQLite3 database, check create-sqlite-from-raw.php
.
Do you have your own dataset of Sepomex? Then you can extend this library,
just create DataGatewayInterface
that implements the methods and get the data from anywhere.
About the SEPOMEX information (as of 2018-02-02)
Sepomex distribute its database of postal codes with a very restrictive clause on its first line:
El Catálogo Nacional de Códigos Postales, es elaborado por Correos de México y se proporciona en forma gratuita para uso particular, no estando permitida su comercialización, total o parcial, ni su distribución a terceros bajo ningún concepto.
That means:
- The data is distributed only for personal use.
- Cannot redistribute the information (total or partial) to anyone (insert a big WTF! here).
- Cannot create any profit of the information.
Anyhow, the data source has been released in https://datos.gob.mx/busca/dataset/catalogo-nacional-de-codigos-postales/resource/2c5c36de-ffed-4dc6-9beb-66369db3a622 by the Mexican government using a libre license called LIBRE USO MX, and it removes any restrictions from the disclaimer.
If you run the script scripts/create-sqlite-from-raw.php
you will create a sqlite database
with the same information but normalized, the script will download the source if it does not exist.
You would find more information about the source raw file inside docs/DATABASE.md (spanish)
What is working
Right now you can search a mexican zip code, and it will give you the information about:
- The state Estado where it is located, like 'Tabasco'
- The district Delegación/Municipio where it is located, like 'Centro'
- A list of locations Colonias, each location contains:
- Name of the location, like '1 de mayo'
- Type of the location, like 'Colonia' or 'Unidad habitacional'
- City Name, like 'Villahermosa'
The city is located under the location entity because the same zip code can include some places inside the city and also some places outside the city. Yes, this is how it works in Mexico.
Contributing
Contributions are welcome! Please read CONTRIBUTING for details and don't forget to take a look the TODO and CHANGELOG files.
License
The eclipxe\sepomexphp
library is copyright © Carlos C Soto
and licensed for use under the MIT License (MIT). Please see LICENSE for more information.
Data source
"Tabla de Códigos Postales y asentamientos humanos" published by "Correos de México". Getting from:
All versions of sepomexphp with dependencies
ext-pdo Version *
ext-iconv Version *
ext-zip Version *