Download the PHP package paulofelipem/brazilian-regions without Composer
On this page you can find all versions of the php package paulofelipem/brazilian-regions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download paulofelipem/brazilian-regions
More information about paulofelipem/brazilian-regions
Files in paulofelipem/brazilian-regions
Package brazilian-regions
Short Description Pacote com informações de todos os paises, estados e cidades (Estados e cidades brasileiras).
License MIT
Homepage https://github.com/PauloFelipeM/brazilian-regions
Informations about the package brazilian-regions
Brazilian Regions for Laravel
A Laravel package that provides migrations, seeders, and Eloquent models for countries, states, and cities — with full data for all Brazilian states and municipalities.
Data sourced from the IBGE Localities API.
Features
- All world countries with M49 codes and region classification
- All 27 Brazilian states with regional data
- All Brazilian municipalities (5,000+)
- Ready-to-use Eloquent models with relationships
- Fully configurable table names, column names, and models
- Auto-discovery support for Laravel 9+
Requirements
- PHP 8.1+
- Laravel 9.0+
Installation
Install the package via Composer:
The service provider is registered automatically. If needed, you can register it manually in config/app.php:
Publish the configuration and migration files:
Note: This publishes a
config/brazilianregions.phpfile. If you already have a file with that name, rename or remove it before publishing.
Usage
Run the migrations and seeders to create and populate the tables:
Then use the provided Eloquent models in your application:
Database Schema
countries
| Column | Description |
|---|---|
id |
Auto-increment primary key |
m_49 |
UN M49 numeric code |
acronym |
ISO Alpha-3 country code |
name |
Country name |
region |
Geographic region |
states
| Column | Description |
|---|---|
id |
Auto-increment primary key |
acronym |
State abbreviation (e.g. SP, RJ) |
name |
State name |
region |
Region name (e.g. Sudeste) |
region_acronym |
Region abbreviation |
country_id |
Foreign key to countries |
cities
| Column | Description |
|---|---|
id |
Auto-increment primary key |
name |
City name |
state_id |
Foreign key to states |
All foreign keys use CASCADE on delete.
Configuration
The published config/brazilianregions.php file allows you to customize:
This is useful when you need to integrate with an existing database schema or extend the default models.
Changelog
See CHANGELOG for release history.
Bugs
If you find any issues, please open an issue on GitHub.
Credits
License
The MIT License (MIT). See LICENSE for more information.