PHPackages                             thehocinesaad/laravel-algereography - 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. thehocinesaad/laravel-algereography

ActiveLibrary

thehocinesaad/laravel-algereography
===================================

Easily add all the 58 Algerian Wilayas and its Dairas to your cool Laravel project (Migrations, Seeders and Models).

v1.3.1(3y ago)532078MITPHPPHP ^7.4|^8.0

Since Sep 2Pushed 3y ago3 watchersCompare

[ Source](https://github.com/theHocineSaad/laravel-algereography)[ Packagist](https://packagist.org/packages/thehocinesaad/laravel-algereography)[ Docs](https://github.com/thehocinesaad/laravel-algereography)[ RSS](/packages/thehocinesaad-laravel-algereography/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

[![](https://camo.githubusercontent.com/9a00031837b57b31bebee9ab0572b255443d3ffe6b9f18be399e0524a52be918/68747470733a2f2f692e696d6775722e636f6d2f303574677450352e706e67)](https://camo.githubusercontent.com/9a00031837b57b31bebee9ab0572b255443d3ffe6b9f18be399e0524a52be918/68747470733a2f2f692e696d6775722e636f6d2f303574677450352e706e67)

Laravel-Algereography
=====================

[](#laravel-algereography)

**Laravel-Algereography** allows you to add Migrations, Seeders and Models of Algerian Wilayas and Dairas to your existing or new cool Laravel project .

**- 58 Wilayas.**
**- 548 Dairas.**
**- Support both Arabic and French languages.**
**- Built in models relationships, so you can for example do: `Daira::find(1)->wilaya` to get the Wilaya of Daira with the id=1.**

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

[](#installation)

#### Step 1 - Require the package

[](#step-1---require-the-package)

```
composer require thehocinesaad/laravel-algereography

```

#### Step 2: Install the package

[](#step-2-install-the-package)

```
php artisan algereography:install

```

This command will do those good stuff for you:

1. Publish two Models, **`Wilaya`** and **`Daira`** to **`app/Models`**.
2. Publish two Migrations, **`create_wilayas_table`** and **`create_dairas_table`** to **`database/migrations`**
3. Publish two Seeders, **`WilayaSeeder`** and **`DairaSeeder`** to **`database/seeders`**
4. Run the two Migrations (**`create_wilayas_table`** and **`create_dairas_table`**)
    **Note:** this operation will automatically overwrite any table with the name of **`wilayas`** and **`dairas`**
5. Run the two Seeders (**`WilayaSeeder`** and **`DairaSeeder`**)
6. Finally, it prints **Done!** to make you know that everything is succefully finished then it will print **1 2 3 Viva l'Algérie!** just to make you a little bit proud of your country ❤️

#### Step 3:

[](#step-3)

There is no step 3, you're done 😉
Check out your database and you will find two new tables, **`wilayas`** and **`dairas`**.

How can I use the package
-------------------------

[](#how-can-i-use-the-package)

As mentioned before, the package publishes two models `Wilaya` and `Daira`, use them just like any other model in your project.

#### Get all Wilayas

[](#get-all-wilayas)

```
Wilaya::all();

```

#### Get all Dairas

[](#get-all-dairas)

```
Daira::all();

```

#### Get Dairas of a Wilaya

[](#get-dairas-of-a-wilaya)

```
Wilaya::findOrFail(15)->dairas

```

#### Get Wilaya of a Daira

[](#get-wilaya-of-a-daira)

```
Daira::findOrFail(205)->wilaya;

```

**Note:** Don't forget to import the models first:

```
use App\Models\Wilaya;
use App\Models\Daira;

```

### Helpers

[](#helpers)

You can also use the package using some Helpers I added that will make your life easier.

#### Helpers list:

[](#helpers-list)

```
$wilayas     =   wilayas();           // Get all Wilayas in all languages
$ar_wilayas  =   wilayas('ar');       // Get all Wilayas in arabic
$ar_wilayas  =   wilayas('fr');       // Get all Wilayas in french

//

$wilaya      =   wilaya(15);          // Get individuel Wilaya in all languages
$ar_wilaya   =   wilaya(15, 'ar');    // Get individuel Wilaya in arabic
$wilaya      =   wilaya(15, 'fr');    // Get individuel Wilaya in french

//

$dairas      =   dairas();            // Get all Dairas in all languages
$ar_dairas   =   dairas('ar');        // Get all Dairas in arabic
$fr_dairas   =   dairas('fr');        // Get all Dairas in french

//

$dairas      =   dairasOf(15);        // Get all Dairas of a Wilaya in all languages
$dairas      =   dairasOf(15, 'ar');  // Get all Dairas of a Wilaya in arabic
$dairas      =   dairasOf(15, 'fr');  // Get all Dairas of a Wilaya in french
```

##### When specifying the language, to access the name attribute just do `->name` and it will automatically get the name in the correct language, so there is no need to do `->ar_name` to get the name in arabic.

[](#when-specifying-the-language-to-access-the-name-attribute-just-do--name-and-it-will-automatically-get-the-name-in-the-correct-language-so-there-is-no-need-to-do--ar_name-to-get-the-name-in-arabic)

#### Example

[](#example)

```
$fr_wilaya  =  wilaya(15, 'fr');   // $fr_wilaya->name will be 'Tizi Ouzou'
$ar_wilaya  =  wilaya(15, 'ar');   // $ar_wilaya->name will be 'تيزي وزو'
```

How cool is that!

Contributing
------------

[](#contributing)

Thank you for considering contributing to Laravel-Algereography project! Feel free to contribute in any way, we welcome every contribution.

License
-------

[](#license)

Laravel-Algereography project is open-sourced software licensed under the [MIT license](https://github.com/theHocineSaad/laravel-algereography/blob/main/LICENSE.md "MIT license").

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~39 days

Total

5

Last Release

1189d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af67db5b2a5eac973faa382288809000f52c9410cb31d70adc82aad91c79bb27?d=identicon)[theHocineSaad](/maintainers/theHocineSaad)

---

Top Contributors

[![theHocineSaad](https://avatars.githubusercontent.com/u/11405387?v=4)](https://github.com/theHocineSaad "theHocineSaad (18 commits)")

---

Tags

algeriaalgeria-administrative-divisionsalgeria-citiesalgeria-provinceslaravelpackagephpthehocinesaadlaravel-algereographyWilayasDairasProvinces of AlgeriaDistricts of AlgeriaAdministrative Divisions of Algeria

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/thehocinesaad-laravel-algereography/health.svg)

```
[![Health](https://phpackages.com/badges/thehocinesaad-laravel-algereography/health.svg)](https://phpackages.com/packages/thehocinesaad-laravel-algereography)
```

###  Alternatives

[thehocinesaad/laravel-error-ai

This package adds Ask AI button to the error page.

2214.4k](/packages/thehocinesaad-laravel-error-ai)[thehocinesaad/laravel-chargily-epay

Laravel-Chargily-ePay is a Laravel package that provides an easy interface to Chargily ePay gateway

202.1k](/packages/thehocinesaad-laravel-chargily-epay)

PHPackages © 2026

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