open-afghanistan/provinces

Afghanistan provinces laravel package
1,141 9
Install
composer require open-afghanistan/provinces
Latest Version:1.0.5
PHP:>=8.1
Laravel:9 – 13
License:MIT
Last Updated:Oct 21, 2026
Links: GitHub  ·  Packagist
Maintainer: hamidafghan

Laravel Package: Afghanistan Provinces & Districts

Latest Version on Packagist Total Downloads Repo Size Repo Size

Introduction:

The Laravel package "provinces" provides essential resources for managing Afghanistan's provinces and districts within your Laravel application. This package includes models, migrations, seeders, and factories to facilitate the integration of Afghanistan's administrative divisions into your project.

Requirements:

To use this package, ensure your Laravel application meets the following requirements:

  • PHP 8.1 or higher
  • Laravel 9 or higher

Installation:

You can effortlessly install the "provinces" package using Composer. Open your terminal and run the following command:

composer require open-afghanistan/provinces

Migrations:

After successful installation, you need to publish the migration files. Use the following Artisan command:

php artisan vendor:publish --tag=provinces-migration

This command will generate a migration file that sets up the necessary tables for provinces and districts in your database.

Seeders:

The package includes a handy ProvincesSeeder that populates all 34 Afghanistan provinces along with their respective districts. You can call this seeder in your project's database seeder file as follows:

// DatabaseSeeder.php

use OpenAfghanistan\Provinces\Database\Seeders\ProvincesSeeder;

$this->call(ProvincesSeeder::class);

If you only wish to seed specific provinces, you can call their individual seeder classes:

// DatabaseSeeder.php

use OpenAfghanistan\Provinces\Database\Seeders\KabulProvinceSeeder;

$this->call(KabulProvinceSeeder::class);

Factories:

To facilitate testing, this package provides factories for both provinces and districts. You can create instances of these models in your tests with ease:

For provinces:

use OpenAfghanistan\Provinces\Models\Province;

Province::factory()->create();

For districts:

use OpenAfghanistan\Provinces\Models\District;

District::factory()->create();

Contribution Guide:

We welcome contributions to enhance this package. If you'd like to contribute by adding districts to any province, specific seeder files are available for each province to simplify the process. Please run the ./vendor/bin/pint command before you push any piece of code.

License:

The "provinces" package is open-source software distributed under the MIT License. You are free to use and modify it to suit your project's requirements.

Feel free to utilize this package to manage Afghanistan's administrative divisions effortlessly in your Laravel application.

Related Packages

ferdirn/laravel-id-provinces

Laravel ID Provinces is a package for Laravel to supply all provinces data to ta...

109 2
didiwijaya/wilindo

Package Laravel (Migration & Seeder) untuk wilayah Indonesia berdasarkan data SP...

1,092 1
azishapidin/indoregion

Package containing region of Indonesia (provinces, regencies, districts, and vil...

83,984 273
plin-code/laravel-istat-geography

Laravel package for importing and managing Italian geography data from ISTAT

9,570 13
dicibi/indoregion

Package containing region of Indonesia (provinces, regencies, districts, and vil...

3,617 0

Version History

Version Released PHP Laravel License
1.0.5 >=8.1 >=9.0 MIT
1.0.4 >=8.1 >=9.0 MIT
1.0.3 >=8.1 >=9.0 MIT
1.0.2 >=8.1 >=9.0 MIT
1.0.1 >=8.1 >=9.0 MIT