https://github.com/raiolanetworks/atlas
Atlas is a PHP package that allows you to create new tables in your database and populate them with information about regions, subregions, countries, states, cities, time zones, and more.
https://github.com/raiolanetworks/atlas
cities countries country-list laravel laravel-framework laravel-package php php8 states
Last synced: 4 months ago
JSON representation
Atlas is a PHP package that allows you to create new tables in your database and populate them with information about regions, subregions, countries, states, cities, time zones, and more.
- Host: GitHub
- URL: https://github.com/raiolanetworks/atlas
- Owner: RaiolaNetworks
- License: mit
- Created: 2024-03-19T08:24:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-20T10:48:23.000Z (about 1 year ago)
- Last Synced: 2025-04-25T19:11:49.951Z (about 1 year ago)
- Topics: cities, countries, country-list, laravel, laravel-framework, laravel-package, php, php8, states
- Language: PHP
- Homepage: https://packagist.org/packages/raiolanetworks/atlas
- Size: 5.45 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Get the data from the most recondite place with 'Atlas'
[](https://packagist.org/packages/raiolanetworks/atlas)
[](https://github.com/raiolanetworks/atlas/actions?query=workflow%3ATests+branch%3Amain)
[](https://github.com/raiolanetworks/atlas/actions?query=workflow%3APint+branch%3Amain)
[](https://packagist.org/packages/raiolanetworks/atlas)
With 'Atlas' you will be able to create new tables in the database and fill them with information about countries, states, cities, timezones and more.
## Requirements
- PHP 8.3+
- Laravel 11+
## Get to know us
[
](https://raiolanetworks.com)
## Installation
Install the package via Composer:
```bash
composer require raiolanetworks/atlas
```
Optionally publish the config file to customise table names or toggle entities:
```bash
php artisan vendor:publish --tag="atlas-config"
```
Run the migrations and seed the database:
```bash
php artisan atlas:install
```
The command will migrate the tables for every entity enabled in `config('atlas.entities')` (all enabled by default) and let you choose which seeders to run. The process may take a few minutes due to the large number of cities.
To re-seed the data after a package upgrade:
```bash
php artisan atlas:update
```
### Other publishable resources
```bash
php artisan vendor:publish --tag="atlas-translations"
php artisan vendor:publish --tag="atlas-jsons" # JSON data files (for overriding)
```
> **Note:** Migrations are auto-loaded by the package. Do **not** publish them with `--tag="atlas-migrations"` unless you have a specific reason — published copies will cause "table already exists" errors.
## Usage
Internally, the package works with Laravel models, which allows you to work with this model as if they were models of your own project.
For example, if you want to get all the countries in Africa:
```php
use Raiolanetworks\Atlas\Models\Country;
class MyClass
{
public function getAllAfricaCountries(): Collection
{
return Country::where('region_name', 'Africa')
->orderBy('name')
->get();
}
}
```
## Upgrading
If you are upgrading from 1.x, please see [UPGRADE.md](./UPGRADE.md) for a list of breaking changes and migration steps.
## Changelog
Please see [CHANGELOG](./CHANGELOG.md) for more information on what has changed recently.
## Credits
- [Martín Gómez](https://github.com/soymgomez)
- [Víctor Escribano](https://github.com/victore13)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.