PHPackages                             indicalabs/yii2-geolocation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. indicalabs/yii2-geolocation

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

indicalabs/yii2-geolocation
===========================

Simple Yii2 component to find geo client information.

01741PHPCI failing

Since Sep 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/indicalabs/yii2-geolocation)[ Packagist](https://packagist.org/packages/indicalabs/yii2-geolocation)[ RSS](/packages/indicalabs-yii2-geolocation/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-geolocation
================

[](#yii2-geolocation)

This is modified extension of

Thanks to rodzadra.

Simple Yii2 component to find geo client information.

[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](http://www.yiiframework.com/)

### Installation

[](#installation)

Installation
------------

[](#installation-1)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require --prefer-dist indicalabs/yii2-geolocation "*"

```

or add

```
"indicalabs/yii2-geolocation": "*"

```

to the require section of your `composer.json` file.

Configuration
-------------

[](#configuration)

1. In your config/main.php

```
'components'=>[
    'geolocation' => [
        'class' => 'indicalabs\geolocation\Geolocation',
        'config' => [
            'provider' => '[PLUGIN_NAME]',
            'return_formats' =>  '[SUPORTED_PLUGIN_FORMATS]',
            'api_key' => '[YOUR_API_KEY],
        ],
    ],
],
```

### Config params

[](#config-params)

```
provider - The name of plugin to use (see examples on @vendor/indicalabs/geolocation/plugins/);

return_formats - The return formats supported by the plugin

api_key - If necessary, you can pass your api key here.
```

### Plugins

[](#plugins)

Plugins are simple PHP files, that returns an array with three vars:

- plugin\_url : URL of webservice, with three special tags:

a) {{accepted\_formats}}

b) {{ip}}

c) {{api\_key}}

These tags will be replaced by their respective values.

- accepted\_formats : An array with the return acceptable formats (example \['csv', 'php', 'json', 'xml'\])
- default\_accepted\_format : String with the default return format. (example "php")

### Plugin file example

[](#plugin-file-example)

```

```

or, to find the geolocation infos from Google server, on your view.

```
