kinatechsolutions / world-data
World data package includes, countries, states, cities, currencies and languages
1.0.1
2023-01-11 13:32 UTC
Requires
- php: ^8.1
README
A laravel package that provides listing of world data including, countries, cities, currencies, postal codes and languages.
Installation
To install this package run
composer require kinatechsolutions/world-data
Then run migrations to create the database tables.
php artisan migrate
To populate your models with data run
php artisan world:populate
Usage/Examples
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Kinatech\World\Facade\World; class MyController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\JsonResponse */ public function index() { $postalCodes = World::postalCode() ->where('country_code', 'KE') ->get(); $countries = World::country()->get(); $states = World::state()->get(); $cities = World::city()->get(); $languages = World::language()->get(); $currencies = World::currency()->get(); return response()->json([ 'data' => $postalCodes ]); } }
Contributing
Contributions are always welcome!
See contributing.md
for ways to get started.
Please adhere to this project's code of conduct
.
Authors
License
The MIT License (MIT). Please see License File for more information.