Download the PHP package thecoder/world without Composer

On this page you can find all versions of the php package thecoder/world. 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 world

🌍 World - PHP & Laravel Package for Geographical Data

World is a powerful PHP and Laravel package for retrieving structured geographical data, including continents, countries, provinces, and cities. This package is lightweight, optimized for performance, and seamlessly integrates with Laravel applications.


πŸš€ Features

βœ” Get all continents, countries, provinces, and cities
βœ” Filter countries by continent
βœ” Retrieve provinces and cities for any country
βœ” Optimized for high performance with caching
βœ” Compatible with Laravel and PHP
βœ” Includes migrations and seeding for easy setup
βœ” includes a Laravel Facade for simpler usage!


πŸ“¦ Installation

Install via Composer:

If auto-discovery is not working, manually add the service provider in config/app.php:

πŸ”§ Publish Configuration & Migrations for Greater Flexibility

This will publish:
βœ… config/world.php (configuration file)
βœ… Database migration files

πŸ›  Migrate the Database

🌍 Seed Geographical Data

This will populate the database with continents, countries, provinces, and cities.


πŸ” Usage

1️⃣ Using the Built-in World Facade (Recommended)

The package now includes a World Facade, making it easier to access data:

2️⃣ Manually Instantiate the Class

Get Locations

Get Countries by Continent

Get Provinces & Cities


⚑Caching for Maximum Performance

Since the World database is static and never changes, this package supports permanent caching to eliminate redundant database queries and significantly improve performance.

Enable Caching

You can enable caching in the file:

Setting ttl to null ensures that data is cached forever.

Use Cached Data in Queries

If caching is enabled, queries will automatically store results in the cache forever.

Manually Clear Cache (If Needed)

To clear the cache manually, run:

Or in code:


πŸ— Package-Integrated Laravel Facade

The package now provides a World Facade out-of-the-box, meaning Laravel users don't need to set it up manually.

βœ” No need to register aliases
βœ” Works automatically in Laravel

Just install the package and start using it:


πŸ§ͺTesting

Ensure you have the necessary dependencies installed:

⚠️ Database Configuration for Testing

Due to special columns in the database, SQLite is not supported for testing.

Instead, configure MySQL in phpunit.xml:

▢️ Running tests

πŸ—„ Database Schema

This package provides a locations table designed to store structured geographic data with hierarchical relationships.

Column Type Description
id Integer (PK) Unique identifier
continent_id Integer (FK) Parent continent (nullable)
country_id Integer (FK) Parent country (nullable)
province_id Integer (FK) Parent province (nullable)
iso_code String (3) ISO country code (e.g., "US")
type Enum continent, country, province, city
english_name String Location name in English
native_name String Local name (optional)
timezone String Time zone (e.g., "Asia/Tehran")
is_capital Boolean Marks capital cities (default: false)
priority Integer Sort priority (default: 0)
center POINT Geographic coordinates
area MULTIPOLYGON Spatial data for regions

βœ… Indexed for fast queries
βœ… Supports geographic coordinates & boundaries


❓ FAQ

πŸ”Ή What is this package used for?

It helps developers retrieve geographical data (continents, countries, provinces, and cities) for Laravel & PHP applications.

πŸ”Ή Is this package compatible with Laravel?

Yes! It fully supports Laravel and can also be used in vanilla PHP projects.

πŸ”Ή How can I filter countries by continent?

πŸ”Ή Can I get cities of a specific province?


⭐ Contribute & Support

πŸ”Ή GitHub Repository: thecoder/world
πŸ”Ή Issues & Features: Submit Here
πŸ”Ή Contribute: Fork, star ⭐, and submit PRs

πŸ’‘ Need more features? Open an issue or contribute to the project!


All versions of world with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/database Version ^8.0|^9.0|^10.0|^11.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 thecoder/world contains the following files

Loading the files please wait ....