2017 © Pedro PelĂĄez
 

library zf3-geolocation

Zend Framework geolocation

image

jenzri-nizar/zf3-geolocation

Zend Framework geolocation

  • Saturday, October 1, 2016
  • by jenzrinizar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

zf3-geolocation

zf3-geolocation, (*1)

zend framework 3 geolocation, (*2)

Installation

1) Ajouter l'exigence suivante Ă  votre fichier composer.json. Dans la section:"require", (*3)

composer require jenzri-nizar/zf3-geolocation v1.0

2) Ouvrez votre ligne de commande et exécutez, (*4)

composer update

Le module doit ĂȘtre enregistrĂ© dans config/modules.config.php, (*5)

'modules' => array(
    '...',
    'Zf3\Geolocation'
),

Configuration

Copiez le fichier situé dans vendor\jenzri-nizar\zf3-geolocation\config\geoip.local.php à config/geoip.local.php, (*6)

Modifiez les paramĂštres dans le fichier config/geoip.local.php, (*7)


provider - Le nom du plug-in à utiliser (voir exemples @vendor/jenzri-nizar/zf3-geolocation/src/Service/plugins/); return_formats - Les formats de retour pris en charge par le plugin api_key - Si nécessaire, vous pouvez passer votre clé api.

Plugins

Plugins sont des fichiers PHP simples, qui renvoie un tableau avec trois variables: - plugin_url :URL du service Web, avec trois balises spéciales:, (*8)

a) {{accepted_formats}}, (*9)

b) {{ip}}, (*10)

c) {{api_key}}, (*11)

Ces balises seront remplacées par leurs valeurs respectives., (*12)

  • accepted_formats : Un tableau avec les formats acceptables (exemple ['csv', 'php', 'json', 'xml']), (*13)

  • default_accepted_format : ChaĂźne avec le format de retour par dĂ©faut. (exemple "php"), (*14)

Exemple de fichier Plugin

 'http://www.geoplugin.net/{{accepted_formats}}.gp?ip={{ip}}',
            'accepted_formats'          => ['json', 'php', 'xml'],
            'default_accepted_format'   => 'php',
    ];

```
##Exemple
```php
public function geopipAction(){
        $GeoIp=$this->GeoIp()->getInfo("87.98.187.238");
        $Weather=$this->GeoIp()->GetWeather($GeoIp->geoplugin_latitude,$GeoIp->geoplugin_longitude,$GeoIp->geoplugin_currencyCode);
        return new ViewModel(array("Weather"=>$Weather,"GeoIp"=>$GeoIp));
    }
```

geopip.phtml

```php
geoplugin_currencyCode) && $GeoIp->geoplugin_currencyCode != 'USD' ) {
        return '(' . $GeoIp->geoplugin_currencySymbol . round( ($amount * $GeoIp->geoplugin_currencyConverter),2) . ')';
    }
    return false;
}
?>


zf3-geolocation

, (*15)

geoplugin_countryName;?> , (*16)

geoplugin_request}:
\n". "City: {$GeoIp->geoplugin_city}
\n". "Region: {$GeoIp->geoplugin_region}
\n". "Area Code: {$GeoIp->geoplugin_areaCode}
\n". "DMA Code: {$GeoIp->geoplugin_dmaCode}
\n". "Country Name: {$GeoIp->geoplugin_countryName}
\n". "Country Code: {$GeoIp->geoplugin_countryCode}
\n". "Longitude: {$GeoIp->geoplugin_longitude}
\n". "Latitude: {$GeoIp->geoplugin_latitude}
\n". "Currency Code: {$GeoIp->geoplugin_currencyCode}
\n". "Currency Symbol: {$GeoIp->geoplugin_currencySymbol}
\n". "Exchange Rate: {$GeoIp->geoplugin_currencyConverter}
\n"; ?>, (*17)

Product A costs $800 ' . cc(800,$GeoIp) . ''; ?>, (*18)

alt tag, (*19)

The Versions

01/10 2016

dev-master

9999999-dev

Zend Framework geolocation

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Jenzri Nizar

geolocation zf3

01/10 2016

v1.0

1.0.0.0

Zend Framework geolocation

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Jenzri Nizar

geolocation zf3