Download the PHP package enadabuzaid/country-data without Composer

On this page you can find all versions of the php package enadabuzaid/country-data. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package country-data

Laravel Country Data

A full-featured Laravel geography package with countries, cities, and areas — backed by a database with caching, geospatial helpers, validation rules, a Livewire cascading dropdown, and an optional REST API.

Built with multilingual support (English & Arabic), region filters, and a clean Geography facade — ideal for any application that needs structured location data.


Features


Requirements


Installation

Publish the config files:


Geography System Setup

1. Run the interactive setup command

The command will ask three things:

2. Non-interactive / CI options

What gets created

Table Content
countries 22 Arab League countries with currency, dial code, timezone, geo coordinates
cities 136 cities across all 22 countries (Jordan: all 12 governorates)
areas 101 areas (Jordan fully covered — 32 Amman neighborhoods + all governorates)

Seeders are idempotent — safe to re-run, they use updateOrInsert.


Geography Facade

Countries

Cities

Areas

Country → Areas (HasManyThrough)


Currency & Timezone Helpers

Currency

Timezones

Dial Codes

Continents


Geospatial Helpers

All distance calculations use the Haversine formula (PHP-level, works with SQLite and all DB drivers).


Validation Rules


Livewire Cascading Dropdown

Requires Livewire 3. The component is auto-registered when Livewire is installed.

Basic usage

With options

Props

Prop Type Default Description
locale string 'en' Display language (en or ar)
filter ?string null Country filter tag (e.g. arab, gulf)
showAreas bool false Show the third area dropdown
required bool false Mark all selects as required
countryField string 'country_code' Hidden input name for country
cityField string 'city_id' Hidden input name for city
areaField string 'area_id' Hidden input name for area

Events emitted

Event Payload
country-selected ['code' => 'JO']
city-selected ['id' => 3]
area-selected ['id' => 12]

Publish the view to customise

Published to: resources/views/vendor/country-data/livewire/geography-select.blade.php


REST API

The API is disabled by default. Enable it in .env:

Or in config/country-data.php:

Endpoints

Countries

Method URL Description
GET /api/geography/countries All countries (?filter=gulf&locale=ar)
GET /api/geography/countries/{code} Single country by ISO-2 code
GET /api/geography/countries/{code}/cities Cities for a country

Cities & Areas

Method URL Description
GET /api/geography/cities/{id} Single city by ID
GET /api/geography/cities/{id}/areas Areas for a city (?type=neighborhood)

Currency & Continents

Method URL Description
GET /api/geography/currencies All unique currencies (?locale=ar)
GET /api/geography/currencies/{code}/countries Countries using a currency
GET /api/geography/continents All distinct continents
GET /api/geography/continents/{name}/countries Countries on a continent

Geospatial

Method URL Description
GET /api/geography/near/cities Cities near a coordinate (?lat=&lng=&radius=&country=)

Search

Method URL Description
GET /api/geography/search/cities Search cities (?q=amman&country=JO)
GET /api/geography/search/areas Search areas (?q=down&city_id=3)

Response shape


Artisan Commands

Command Description
php artisan country-data:setup Interactive migrate + selective seed
php artisan country-data:setup --migrate Run migrations only
php artisan country-data:setup --seed --all Seed all countries without prompting
php artisan country-data:setup --seed --countries=JO,SA Seed specific countries
php artisan country-data:setup --fresh --all Drop tables, migrate, seed all
php artisan country-data:cache-clear Flush all geography cache entries
php artisan country-data:stats Display seeded counts, cache status
php artisan country-data:configure Choose config-based country dataset
php artisan country-data:publish-component Publish Blade/Vue/React frontend component

country-data:stats output


Cache Configuration

Flush manually:

Or via artisan:

The cache is also flushed automatically after seeding.


Config Reference


Config-Based Facade (v1 — still available)

For lightweight use without a database, the original CountryData facade works from config:


File Structure


Testing

The test suite runs on an SQLite in-memory database — no external DB needed.


License

MIT — built by @enadabuzaid


All versions of country-data with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0 || ^12.0 || ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package enadabuzaid/country-data contains the following files

Loading the files please wait ...