Download the PHP package plin-code/laravel-istat-foreign-countries without Composer
On this page you can find all versions of the php package plin-code/laravel-istat-foreign-countries. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download plin-code/laravel-istat-foreign-countries
More information about plin-code/laravel-istat-foreign-countries
Files in plin-code/laravel-istat-foreign-countries
Package laravel-istat-foreign-countries
Short Description Laravel package for importing and managing foreign countries data from ISTAT
License MIT
Homepage https://github.com/plin-code/laravel-istat-foreign-countries
Informations about the package laravel-istat-foreign-countries
Laravel ISTAT Foreign Countries
A Laravel package for importing and managing foreign countries data from ISTAT (Italian National Institute of Statistics).
Features
- 🌍 Import continents, geographical areas, and foreign countries from ISTAT
- 🔗 Eloquent models with hierarchical relationships
- ⚡ Artisan command for easy data import
- 🔧 Fully configurable via configuration file
- 🆔 UUID primary keys and soft deletes support
- 🏷️ Multiple coding standards support (ISTAT, ISO, MIN, AT)
Requirements
- PHP 8.3+
- Laravel 12.0+ or 13.0+
- league/csv 9.0+
Installation
Quick Start
-
Install the package:
-
Publish the configuration:
-
Run migrations:
- Import the data:
That's it! You now have all foreign countries data in your database.
Configuration
Publish the configuration file:
Usage
Data Import
To import all foreign countries data from ISTAT:
Models
The package provides three Eloquent models:
Continent
Area
Country
Facade Usage
Available Codes
Each country includes multiple international coding standards:
- ISTAT Code: Italian statistical code
- ISO Alpha-2: Two-letter country code (e.g., "FR")
- ISO Alpha-3: Three-letter country code (e.g., "FRA")
- AT Code: Italian territorial code
Database Structure
Continents
id(UUID, primary key)name(string)istat_code(string, unique)created_at,updated_at,deleted_at
Areas
id(UUID, primary key)continent_id(UUID, foreign key)name(string)istat_code(string, unique)created_at,updated_at,deleted_at
Countries
id(UUID, primary key)continent_id(UUID, foreign key)area_id(UUID, foreign key)parent_country_id(UUID, foreign key, nullable)type(string: 'S' for State, 'T' for Territory)name(string: Italian name)istat_code(string, unique)iso_alpha2(string, 2 chars)iso_alpha3(string, 3 chars)at_code(string)created_at,updated_at,deleted_at
Relationships
Continent→hasMany→AreaContinent→hasMany→CountryArea→belongsTo→ContinentArea→hasMany→CountryCountry→belongsTo→ContinentCountry→belongsTo→AreaCountry→belongsTo→Country(parent country, for territories)Country→hasMany→Country(territories)
Configuration
The config/istat-foreign-countries.php file allows you to customize:
- Database connection: Specify a custom database connection
- Table names: Customize the database table names
- Model classes: Use your own model classes by extending the base ones
- CSV URL: Change the ISTAT data source URL
- Temporary file name: Customize the cache file name
Example Configuration
Testing
Run the test suite:
The package includes:
- ✅ Unit tests for models and relationships
- ✅ Feature tests for the import service
- ✅ Mocked HTTP requests (no external dependencies)
- ✅ PHPStan static analysis (Level 5)
- ✅ Pest PHP testing framework
- ✅ Architecture tests
Run Static Analysis
Code Style Formatting
Contributing
- Fork the project
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Credits
Data source: ISTAT - Italian National Institute of Statistics
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-istat-foreign-countries with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^12.0||^13.0
league/csv Version ^9.27