Custom library for address search by brazilians cep or listing regions, states, cities and district, using postmon and ibge service

dev-master 2020-05-20 00:35 UTC

This package is auto-updated.

Last update: 2024-04-20 09:15:38 UTC


README

Latest Version on Packagist Total Downloads Build Status

The Carrier is a package for PHP and Laravel that provides integration with postmon and the IBGE api to allow searches of addresses by cep and listings of states, cities, neighborhoods and regions of Brazil.

Installation

Via Composer

Pull this package in through Composer.

    {
        "require": {
            "anselmojacyntho/carrier": "dev-master"
        }
    }

or run in terminal: composer require anselmojacyntho/carrier

Laravel 5.0+ Integration

Add the service provider to your config/app.php file:

    'providers'     => array(

        //...        
        AnselmoJacyntho\Carrier\CarrierServiceProvider::class

    ),

Add the facade to your config/app.php file:

    'aliases'       => array(

        //...        
        'Carrier' => AnselmoJacyntho\Carrier\Facades\Carrier::class

    ),

Usage

The package provides an easy interface for search address by CEP or litings regions, states, cities and neighborhoods from your application.

Laravel usage

    use AnselmoJacyntho\Carrier\Facades\Carrier;

    // Get address by cep
    $response = Carrier::findByCep('328947');

    // Get all regions
    $response = Carrier::getRegions();

    // Get states by region id
    $response = Carrier::getStatesByRegion(1);

    // Get all states
    $response = Carrier::getStates();

    // Get all cities
    $response = Carrier::getCities();

    // Get city by state id
    $response = Carrier::getCitiesByState(3);

    // Get all district by city id
    $response = Carrier::getDistrictsByCity(3550308);

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.