jiejunf/laravel-locations

location data, flag and api for laravel.

v2.0.1 2022-02-15 23:38 UTC

This package is auto-updated.

Last update: 2024-04-16 04:53:58 UTC


README

中文

This package provide location data, flag and api for laravel.

install

composer require jiejunf/laravel-locations

resource

publish config

php artisan vendor:publish --provider="Jiejunf\\LaravelLocations\\LocationProvider"

make flags dir

Package service provider always sets flags-path into config.filesystems.links on boot.

php artisan storage:link

This script will make a symbol link in /public. You should add it into /.gitignore .

API

api routes have a prefix, setting in locations.route. default is api/locations/.

Data can be corrected in the configuration locations.fix_countries.

  • GET countries
    • query:
      • page int optional page number. Default no paging.
      • per_page int optional per page count. Default 30
      • sort_by string|array optional Default iso2
      • descending bool optional active if sort_by is string. Default false
      • sort_option string optional for phone. Default REGULAR.
        • REGULAR
        • STRING

The API resource class can be used to modify the response content. default:

php artisan make:resource Locations/Country

Or specify in locations.api_resources

upgrade

from v1

All object types returned from the Location class are changed to array