{"id":34924514,"url":"https://github.com/ritechoice23/laravel-worldable","last_synced_at":"2026-04-18T05:03:07.789Z","repository":{"id":328933886,"uuid":"1116939908","full_name":"ritechoice23/laravel-worldable","owner":"ritechoice23","description":"Make your Laravel application location-aware in seconds. Worldable is a package that provides a simple and efficient way to add Country, State, City, Currency, Language, and Timezone relationships to your laravel application.","archived":false,"fork":false,"pushed_at":"2026-01-13T01:02:47.000Z","size":216,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-13T05:00:51.648Z","etag":null,"topics":["laravel-framework","laravel-package","laravel-worldable","world-data"],"latest_commit_sha":null,"homepage":"https://github.com/ritechoice23/laravel-worldable","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ritechoice23.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ritechoice23"}},"created_at":"2025-12-15T15:43:37.000Z","updated_at":"2026-01-13T01:02:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ritechoice23/laravel-worldable","commit_stats":null,"previous_names":["ritechoice23/laravel-worldable"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ritechoice23/laravel-worldable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritechoice23%2Flaravel-worldable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritechoice23%2Flaravel-worldable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritechoice23%2Flaravel-worldable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritechoice23%2Flaravel-worldable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ritechoice23","download_url":"https://codeload.github.com/ritechoice23/laravel-worldable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritechoice23%2Flaravel-worldable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31957158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel-framework","laravel-package","laravel-worldable","world-data"],"created_at":"2025-12-26T14:18:09.916Z","updated_at":"2026-04-18T05:03:07.771Z","avatar_url":"https://github.com/ritechoice23.png","language":"PHP","funding_links":["https://github.com/sponsors/ritechoice23","https://buymeacoffee.com/ritechoice23"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"assets/laravel_worldable_thumbnail.png\" alt=\"Laravel Worldable Thumbnail\" width=\"100%\"\u003e\n\u003c/p\u003e\n\n# Laravel Worldable\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/ritechoice23/laravel-worldable.svg?style=flat-square)](https://packagist.org/packages/ritechoice23/laravel-worldable)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/ritechoice23/laravel-worldable/run-tests.yml?branch=master\u0026label=tests\u0026style=flat-square)](https://github.com/ritechoice23/laravel-worldable/actions?query=workflow%3Arun-tests+branch%3Amaster)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/ritechoice23/laravel-worldable/fix-php-code-style-issues.yml?branch=master\u0026label=code%20style\u0026style=flat-square)](https://github.com/ritechoice23/laravel-worldable/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amaster)\n[![Total Downloads](https://img.shields.io/packagist/dt/ritechoice23/laravel-worldable.svg?style=flat-square)](https://packagist.org/packages/ritechoice23/laravel-worldable)\n[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-support-yellow.svg?style=flat-square)](https://buymeacoffee.com/ritechoice23)\n\n**Make your Laravel application location-aware in seconds.** Worldable is a package that provides a simple and efficient way to add Country, State, City, Currency, Language, and Timezone relationships to your laravel application.\n\n## Quick Start\n\n```bash\ncomposer require ritechoice23/laravel-worldable\n```\n\n**That's it!** You now have access to 8 world entities: Continents, Subregions, Countries, States, Cities, Currencies, Languages, and Timezones.\n\n## Installation Options\n\n```bash\n# Install everything (all world data + polymorphic support)\nphp artisan world:install --all\n\n# Install specific components only\nphp artisan world:install --countries --currencies\n\n# Add polymorphic support later\nphp artisan world:install --worldables\n\n# Uninstall any component you don't need again\nphp artisan world:uninstall\n```\n\n### Optional: Publish Configuration\n\nIf you need to customize table names, publish the config file:\n\n```bash\nphp artisan vendor:publish --tag=worldable-config\n```\n\nThis creates `config/worldable.php` where you can customize table names to match your naming convention.\n\n## Usage Modes\n\n### 1. Direct Model Usage (Traditional Approach)\n\nUse world data models directly with standard Eloquent relationships:\n\n```php\nuse Ritechoice23\\Worldable\\Models\\Country;\nuse Ritechoice23\\Worldable\\Models\\Currency;\n\n// Add foreign keys to your model\nSchema::table('users', function (Blueprint $table) {\n    $table-\u003eforeignId('country_id')-\u003enullable()-\u003econstrained('world_countries');\n    $table-\u003eforeignId('currency_id')-\u003enullable()-\u003econstrained('world_currencies');\n});\n\n// Use standard relationships\nclass User extends Model {\n    public function country() {\n        return $this-\u003ebelongsTo(Country::class);\n    }\n}\n\n$user-\u003ecountry_id = Country::where('name', 'Nigeria')-\u003efirst()-\u003eid;\n$user-\u003esave();\n```\n\n### 2. Polymorphic Relationships (Zero-Migration Approach)\n\n**Too lazy to add foreign keys?** We got you covered! Use the `Worldable` trait for instant location awareness without touching your database schema:\n\n```php\nuse Ritechoice23\\Worldable\\Traits\\Worldable;\n\nclass User extends Model {\n    use Worldable;  // That's it!\n}\n\n// Attach world data on the fly\n$user-\u003eattachCountry('Nigeria');\n$user-\u003eattachCity('Lagos', 'billing');\n$user-\u003eattachCurrency('NGN');\n$user-\u003eformatMoney(5000);  // \"₦5,000.00\"\n\n// Query naturally\nUser::whereFrom('Nigeria')-\u003eget();\nUser::wherePricedIn('USD')-\u003eget();\n```\n\n**Why use polymorphic relationships?**\n\n-   **Zero migrations** - No need to modify your existing tables\n-   **Multiple contexts** - Separate billing/shipping, citizenship/residence\n-   **Flexible** - Attach multiple countries, cities, or currencies to one model\n-   **Metadata support** - Store extra data on relationships\n-   **Clean codebase** - No foreign key clutter in your models\n\n## Key Features\n\n| Feature              | Description                                                                         |\n| -------------------- | ----------------------------------------------------------------------------------- |\n| **8 World Entities** | Continents, Subregions, Countries, States, Cities, Currencies, Languages, Timezones |\n| **Modular Install**  | Install only what you need, add more later                                          |\n| **Two Usage Modes**  | Traditional foreign keys OR polymorphic relationships                               |\n| **Context Groups**   | Separate billing/shipping, citizenship/residence                                    |\n| **Smart Resolution** | Accepts IDs, names, ISO codes automatically                                         |\n| **Query Scopes**     | `whereFrom()`, `whereLocatedInCity()`, `wherePricedIn()`, `whereSpeaks()`           |\n| **Money Formatting** | `$product-\u003eformatMoney(100)` → \"$100.00\" with locale support                        |\n| **Bulk Operations**  | `$user-\u003eattachCountries(['NG', 'GH', 'KE'])`                                        |\n| **Custom Metadata**  | Store extra data: `$user-\u003eattachCountry('NG', 'billing', ['tax_id' =\u003e '...'])`      |\n| **Health Checks**    | `php artisan world:health --detailed` monitors data integrity                       |\n\n## Real-World Example\n\n```php\nclass Order extends Model {\n    use Worldable;\n}\n\n// E-commerce checkout with multiple contexts\n$order\n    -\u003eattachCountry('United States', 'billing')\n    -\u003eattachState('California', 'billing')\n    -\u003eattachCountry('Canada', 'shipping')\n    -\u003eattachCity('Toronto', 'shipping')\n    -\u003eattachCurrency('USD', 'display')\n    -\u003eattachCurrency('CAD', 'settlement');\n\n// Analytics\n$usOrders = Order::whereFrom('United States')-\u003ecount();\n$canadaShipping = Order::whereHas('countries', fn($q) =\u003e\n    $q-\u003ewhere('name', 'Canada')-\u003ewherePivot('group', 'shipping')\n)-\u003ecount();\n\n// Conditional logic\nif ($order-\u003ehasCountry('United States', 'billing')) {\n    // Apply US tax rules\n}\n```\n\n## Documentation\n\n**[Full Documentation](docs/)** - Deep dive into all features\n\n-   [Installation](docs/installation.md) - Advanced installation options\n-   [Commands](docs/commands.md) - Complete commands reference\n-   [Basic Usage](docs/basic-usage.md) - Common operations\n-   [API Reference](docs/api-reference.md) - Complete API documentation\n-   [Countries](docs/countries.md), [States](docs/states.md), [Cities](docs/cities.md) - Location data\n-   [Currencies](docs/currencies.md), [Languages](docs/languages.md), [Timezones](docs/timezones.md) - Localization\n-   [Groups](docs/groups.md) - Context-aware relationships\n-   [Meta Data](docs/meta-data.md) - Custom metadata storage\n-   [Validation Rules](docs/validation-rules.md) - Input validation\n-   [Scopes](docs/scopes.md) - Query scopes reference\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Credits\n\n-   [Daramola Babatunde Ebenezer](https://github.com/ritechoice23)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). See [License File](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritechoice23%2Flaravel-worldable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fritechoice23%2Flaravel-worldable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritechoice23%2Flaravel-worldable/lists"}