2017 © Pedro Peláez
 

library laravel-sepomex

Servicio Postal Mexicano (Sepomex) laravel library

image

wafto/laravel-sepomex

Servicio Postal Mexicano (Sepomex) laravel library

  • Saturday, February 17, 2018
  • by wafto
  • Repository
  • 1 Watchers
  • 1 Stars
  • 41 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 128 % Grown

The README.md

Laravel Sepomex

Total Downloads Latest Stable Version License, (*1)

Introduction

This package provides postal code SEPOMEX information (unofficial) for Laravel., (*2)

Installation

You can install this package by running:, (*3)

composer require wafto/laravel-sepomex

Setup

In order to setup this package, the next steps are needed., (*4)

1) Configuration file

Publish the sepomex.php configuration file under app/config using the following command:, (*5)

php artisan vendor:publish --provider="Wafto\Sepomex\SepomexServiceProvider"

Here the configuration like table_name and source_file can be changed., (*6)

3) Source file

Download and copy file datos.gob.mx in the storage directory as cpdescarga.txt, note that this path should match with the config file., (*7)

4) Migrate and Import

After configuring the file path and table name, run migrations and run the importer command., (*8)

php artisan migrate
php artisan sepomex:import --chunk=50

This step might took some time to finish., (*9)

Usage

Only inject the contract Wafto\Sepomex\Contracts\SepomexContract or use app(Wafto\Sepomex\Contracts\SepomexContract::class) to get the singleton instance., (*10)

...
use Wafto\Sepomex\Contracts\SepomexContract;

class SepomexController extends Controller
{
    public function postal(SepomexContract $sepomex, $postal)
    {
        return $sepomex->getByPostal($postal);
    }

    public function states(SepomexContract $sepomex)
    {
        return $sepomex->getStates();
    }
}

The second option is to use the Sepomex Facade by editing the config/app.php by adding the alias., (*11)

'aliases' => [
    ...
    'Sepomex' => Wafto\Sepomex\Facades\Sepomex::class,
]

And using anywhere in your application., (*12)

...

class SepomexController extends Controller
{
    public function postal($postal)
    {
        return Sepomex::getByPostal($postal);
    }

    public function states()
    {
        return Sepomex::getStates();
    }
}

Important Notes

The database is distributed with a restrictive clause on the first line of the file., (*13)

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., (*14)

But the database has been released under the license LIBRE USO MX so hopefully in the future the clause in the file change., (*15)

Source (Fuente)

"Catálogo Nacional de Códigos Postales" publicado por Correos de México. Consultado en https://datos.gob.mx/busca/dataset/catalogo-nacional-de-codigos-postales el 2017-11-06., (*16)

License

Laravel Sepomex is open-sourced software licensed under the MIT license., (*17)

The Versions

17/02 2018

dev-master

9999999-dev

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aftab Hussain Miranda

laravel mexico sepomex

17/02 2018

dev-develop

dev-develop

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aftab Hussain Miranda

laravel mexico sepomex

17/02 2018

v1.2.0

1.2.0.0

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aftab Hussain Miranda

laravel mexico sepomex

13/12 2017

v1.1.3

1.1.3.0

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mexico sepomex

24/11 2017

v1.1.2

1.1.2.0

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mexico sepomex

16/11 2017

v1.1.1

1.1.1.0

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mexico sepomex

12/11 2017

v1.1.0

1.1.0.0

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mexico sepomex

09/11 2017

v1.0.1

1.0.1.0

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mexico sepomex wafto

09/11 2017

v1.0.0

1.0.0.0

Servicio Postal Mexicano (Sepomex) laravel library

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel mexico sepomex wafto