Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmyers/fuel-location
A Location Package for Fuel
https://github.com/dmyers/fuel-location
Last synced: 1 day ago
JSON representation
A Location Package for Fuel
- Host: GitHub
- URL: https://github.com/dmyers/fuel-location
- Owner: dmyers
- License: mit
- Created: 2012-07-15T00:33:41.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-03-02T19:32:43.000Z (over 9 years ago)
- Last Synced: 2023-03-14T08:20:24.031Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 198 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Fuel Location Package
A super simple Location package for Fuel.
## About
* Version: 1.0.0
* License: MIT License
* Author: Derek Myers## Installation
### Git Submodule
If you are installing this as a submodule (recommended) in your git repo root, run this command:
$ git submodule add git://github.com/dmyers/fuel-location.git fuel/packages/location
Then you you need to initialize and update the submodule:
$ git submodule update --init --recursive fuel/packages/location/
### Download
Alternatively you can download it and extract it into `fuel/packages/location/`.
## Setup
### Run migrations
Run the migrations which will create the table structure in your database.
$ php oil r migrate --packages=location
### Run task
Run the oil task which will download and import the provider location databases into your local database. The supported providers are [MaxMind](http://maxmind.com) and [GeoNames](http://geonames.org).
$ php oil r location
## Usage
```php
$country = Location::find_country('us');
$state = Location::find_state('us', 'ca');
$city = Location::find_city('us', 'ca', 'san-francisco');
```Or if using the [Geolocate](https://github.com/dmyers/fuel-geolocate) package, you can simply get the visitor's location by their IP.
```php
$city = Location::find_city_by_ip();
```## Updates
In order to keep the package up to date simply run:
$ git submodule update --recursive fuel/packages/location/