Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thedevsbuddy/laraworld
A simple package for the world data (Country, State and City)
https://github.com/thedevsbuddy/laraworld
Last synced: 1 day ago
JSON representation
A simple package for the world data (Country, State and City)
- Host: GitHub
- URL: https://github.com/thedevsbuddy/laraworld
- Owner: thedevsbuddy
- License: mit
- Created: 2021-12-15T18:11:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-14T09:59:17.000Z (over 2 years ago)
- Last Synced: 2024-05-01T14:26:34.265Z (6 months ago)
- Language: PHP
- Size: 4.49 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# LaraWorld
A simple package for the world data (Country, State and City)Get the country state and city related data for your laravel projects.
## Installation
You can install the package via composer:
```bash
composer require thedevsbuddy/laraworld
```Publish the assets
```bash
php artisan vendor:publish --provider="Devsbuddy\Laraworld\LaraworldServiceProvider"
```Create Country, State and City tables and Import data.
```bash
php artisan laraworld:import
```## Usage
#### jQuery
LaraWorld uses ajax to fetch the country state and city data which requires ```jQuery``` as a dependency.
So you will have to use ```jQuery``` in the page before adding ```laraworldScripte``` in the page.Load ```jQuery``` and ```laraworldScripts``` In your ```app.blade.php``` or wherever needed.
```html
@laraworldScripts```
To show dropdown in any page for the country, state and city you can use.
```html```
That's it, You don't have to do anything else.
Now it will automatically populate the countries and when you select a country it will show state list and so on.### Additional options
#### Set default value
If you want to set the default selected option / value you can do that as well.
To set default value you can pass ```data-value``` property in the ```select``` element.**Example**
```html
```#### Select2
If you want to use ```select2``` on your app we have also covered it.To initialized ```select2``` just add ```select2``` class in the select element.
#### Example
```html```
**Note:- You will have to import ```select2``` CDN in the page.**### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Shoaib Khan](https://github.com/devsbuddy)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
## Laravel Package Boilerplate
This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).