PHPackages                             metalgeek/states-and-local-govt - 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. [Database &amp; ORM](/categories/database)
4. /
5. metalgeek/states-and-local-govt

ActiveLibrary[Database &amp; ORM](/categories/database)

metalgeek/states-and-local-govt
===============================

Populates your DB with all the states in Nigeria and their local governments. It also creates the models for you

02PHP

Since Jun 30Pushed 2y agoCompare

[ Source](https://github.com/metalgeek/Laravel-Nig-States-LocalGovt)[ Packagist](https://packagist.org/packages/metalgeek/states-and-local-govt)[ RSS](/packages/metalgeek-states-and-local-govt/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel-Nig-States-LocalGovt
============================

[](#laravel-nig-states-localgovt)

A Laravel Package that populates your database with all the states in the Nigeria and their corresponding local governments.

Setup
-----

[](#setup)

- Include package in your project by running `composer require bodunde/states-and-local-govt`
- Add `Bodunde\SLG\SLGServiceProvider::class` to provider in `app.php` under `config` directory
- Publish package resources by running `php artisan vendor:publish`. Running this command would publish models, migrations and seeders.
- Run published migrations `php artisan migrate`
- Regenerate your autoload files `composer dump-autoload`
- Run published database seeders `php artisan db:seed --class=SlgTableSeeder`

Usage
-----

[](#usage)

- Import models into your controllers

**Note: If your root namespace in your application isn't `app` make sure you go to the models and modify the namespace**

```
...
use App\State;
use App\LocalGovt;

...
...
// fetch all states
$states = State::all();

// fetch state by id
$state = State::find($id) // where $id = 1

// fetch state by name
$state = State::findByName("Lagos State");

//get state local governments
$lg = $state->localGovernments;

// get all local governments
$lgs = LocalGovt::all();

// fetch local government by id
$lg = LocalGovt::find($id) // where $id = 1

// fetch local government state
$state = $lg->state;
```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73.3% 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://www.gravatar.com/avatar/30d3a04da9b244c4145eb1969a5591881ed7dcfebade8654cafb876fb26fa0f9?d=identicon)[metalgeek](/maintainers/metalgeek)

---

Top Contributors

[![bodunadebiyi](https://avatars.githubusercontent.com/u/16083774?v=4)](https://github.com/bodunadebiyi "bodunadebiyi (11 commits)")[![metalgeek](https://avatars.githubusercontent.com/u/57986457?v=4)](https://github.com/metalgeek "metalgeek (3 commits)")[![raphyabak](https://avatars.githubusercontent.com/u/58911706?v=4)](https://github.com/raphyabak "raphyabak (1 commits)")

### Embed Badge

![Health badge](/badges/metalgeek-states-and-local-govt/health.svg)

```
[![Health](https://phpackages.com/badges/metalgeek-states-and-local-govt/health.svg)](https://phpackages.com/packages/metalgeek-states-and-local-govt)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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