PHPackages                             ruwer/brcities - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ruwer/brcities

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

ruwer/brcities
==============

Full package with brazilian cities.

134.9k3PHP

Since Nov 29Pushed 7y agoCompare

[ Source](https://github.com/ricardoruwer/BRCities)[ Packagist](https://packagist.org/packages/ruwer/brcities)[ RSS](/packages/ruwer-brcities/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

BiRCities for Laravel 5
=======================

[](#bircities-for-laravel-5)

[![Codacy Badge](https://camo.githubusercontent.com/086cf2b3efa85c346552e5b3ed97cd0e2bec4357e6651b7d6c629c0eea18692e/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3435366561303261383131363461396339323563623133376239373539366631)](https://www.codacy.com/app/ricardoruwer/BiRCities?utm_source=github.com&utm_medium=referral&utm_content=ricardoruwer/BiRCities&utm_campaign=Badge_Grade)[![Total Downloads](https://camo.githubusercontent.com/867b717895e63a91a4b319210e04cd9708750123361b30a45fb7640a5a516632/68747470733a2f2f706f7365722e707567782e6f72672f72757765722f62726369746965732f646f776e6c6f616473)](https://packagist.org/packages/ruwer/brcities)[![Build Status](https://camo.githubusercontent.com/843ac4425bfc9eb89da4644e24c7cb6520a7734dcb76374aebc4af4ea4183380/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f7269636172646f72757765722f6269726369746965732e737667)](https://github.com/ricardoruwer/bircities)

- A **Laravel 5** package containing all Brazilian cities to your database.
- Auto-fill the cities when you select the state. Built using **Vanilla JS**.
- Works well with [Cep Package](https://github.com/ricardoruwer/Cep).

Installation
------------

[](#installation)

Run in your terminal:

```
composer require "ruwer/brcities":"dev-master"
```

Open the file **config/app.php** and add to "providers":

```
'providers' => [
    // ...
    Ruwer\BRcities\BrcitiesServiceProvider::class,
],
```

Let's publish the package files into your project. Run in your terminal:

```
php artisan vendor:publish
```

Now you have the following files in your project:

- database/migrations/2014\_10\_12\_000000\_create\_cities\_table.php
- database/seeds/CitiesTableSeeder.php

You also have a copy of **brcities.js** in the following folders of your project:

- public/js/brcities.js
- resources/assets/js/brcities.js

So, run in your terminal:

```
composer dump-autoload
php artisan migrate
php artisan db:seed --class="CitiesTableSeeder"
```

Done! :)

Model
-----

[](#model)

Now you can use your new model **City**, e.g.:

```
use Ruwer\BRcities\City;

$states = City::select("state")->distinct("state")->orderBy("state")->get();
$pr_cities = City::where("state", "=", "PR")->orderBy("name")->get();
```

Routes
------

[](#routes)

You also have the following routes returning JSON, e.g.:

- myproject.dev/states
- myproject.dev/cities/PR

Usage
-----

[](#usage)

Create your form:

```

```

Include the .js file:

```

```

Call the script:

```

  var cities = new Cities("#form");

```

Options
-------

[](#options)

Define the **class**:

```
//My Personal Options
var options = {
  stateInput: ".js-state", //default
  cityInput:  ".js-city", //default
  short: false //default (Long state names)
}

//Call the Script
var cities = new Cities("#form", options);
```

Set **placeholders**:

```

    Please select...

    Please select the state first...

```

**Default** value:

```

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7904540?v=4)[Ricardo Ruwer](/maintainers/ricardoruwer)[@ricardoruwer](https://github.com/ricardoruwer)

---

Top Contributors

[![ricardoruwer](https://avatars.githubusercontent.com/u/7904540?v=4)](https://github.com/ricardoruwer "ricardoruwer (2 commits)")

### Embed Badge

![Health badge](/badges/ruwer-brcities/health.svg)

```
[![Health](https://phpackages.com/badges/ruwer-brcities/health.svg)](https://phpackages.com/packages/ruwer-brcities)
```

###  Alternatives

[moltin/laravel-cart

Shopping cart package

27624.9k](/packages/moltin-laravel-cart)[rych/bytesize

Utility component for nicely formatted file sizes

31225.5k11](/packages/rych-bytesize)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
