All Projects → snapshotpl → ZfSnapGeoip

snapshotpl / ZfSnapGeoip

Licence: other
Maxmind Geoip module for Zend Framework 2

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to ZfSnapGeoip

geoip2-rs
Fast GeoIP2 Reader for Rust
Stars: ✭ 25 (+66.67%)
Mutual labels:  geoip, maxmind-geoip
geoip
🌚 🌍 🌝 GeoIP 规则文件加强版,同时支持定制 V2Ray dat 格式路由规则文件 geoip.dat 和 MaxMind mmdb 格式文件 Country.mmdb。Enhanced edition of GeoIP files for V2Ray, Xray-core, Trojan-Go, Clash and Leaf, with replaced CN IPv4 CIDR available from ipip.net, appended CIDR lists and more.
Stars: ✭ 524 (+3393.33%)
Mutual labels:  geoip, maxmind-geoip
twbs-helper-module
Laminas (formerly Zend Framework) module for easy integration of Twitter Bootstrap
Stars: ✭ 18 (+20%)
Mutual labels:  module, zend-framework
lua-resty-maxminddb
A Lua library for reading MaxMind's Geolocation database
Stars: ✭ 72 (+380%)
Mutual labels:  geoip, maxmind-geoip
pf-azure-sentinel
Parse pfSense/OPNSense logs using Logstash, GeoIP tag entities, add additional context to logs, then send to Azure Sentinel for analysis.
Stars: ✭ 24 (+60%)
Mutual labels:  geoip, maxmind-geoip
puppetlabs-xinetd
Module for managing entries in xinetd
Stars: ✭ 13 (-13.33%)
Mutual labels:  module
puppetlabs-activemq
Puppet ActiveMQ Module
Stars: ✭ 25 (+66.67%)
Mutual labels:  module
ngx-localstorage
An Angular wrapper for localstorage/sessionstorage access.
Stars: ✭ 27 (+80%)
Mutual labels:  module
webApi-angularjs
⚓ Definitely simplifies your work with server side & organizes webApi layout to further managing.
Stars: ✭ 15 (+0%)
Mutual labels:  module
SnipWire
Full Snipcart shopping cart integration for ProcessWire CMF
Stars: ✭ 16 (+6.67%)
Mutual labels:  module
icingaweb2-module-businessprocess
Create top-level views of your applications in a graphical editor. Rules express dependencies between existing hosts and services and let you alert on application level. Business processes are displayed in a tree or list overview.
Stars: ✭ 106 (+606.67%)
Mutual labels:  module
Framer-Module-ShakeEvent
Shake event for your prototype.
Stars: ✭ 62 (+313.33%)
Mutual labels:  module
wp-statistics
Complete WordPress Analytics and Statistics for your site!
Stars: ✭ 83 (+453.33%)
Mutual labels:  geoip
zscilib
An open-source scientific computing library for embedded systems running Zephyr OS or standalone.
Stars: ✭ 85 (+466.67%)
Mutual labels:  module
A71-Hidden-Mods
A magisk module adding some mods to your Galaxy A71 systemlessly.
Stars: ✭ 16 (+6.67%)
Mutual labels:  module
zf-dependency-injection
Advanced dependency injection for laminas framework
Stars: ✭ 17 (+13.33%)
Mutual labels:  zend-framework
TairString
A redis module, similar to redis string, but you can set expire and version for the value. It also provides many very useful commands, such as cas/cad, etc.
Stars: ✭ 99 (+560%)
Mutual labels:  module
nuxt-ts-module
A tiny module to use Typescript within Nuxt.js application.
Stars: ✭ 21 (+40%)
Mutual labels:  module
JB2A DnD5e
Templates of spells from the DnD5e ruleset (SRD and PHB), to use on FoundryVTT
Stars: ✭ 28 (+86.67%)
Mutual labels:  module
tinygeoip
🐉 tiny geoip microservice
Stars: ✭ 13 (-13.33%)
Mutual labels:  geoip

ZfSnapGeoip Build Status Scrutinizer Code Quality

Maxmind Geoip module for Zend Framework 2

Created by Witold Wasiczko

Usage

Default ZfSnapGeoip returns Record object created by current user's IP address.

In controller:

$record = $this->getServiceLocator()->get('geoip')->getRecord();
echo $record->getCity();
$record = $this->getServiceLocator()->get('geoip')->getRecord('216.239.51.99');
echo $record->getLongitude();
echo $record->getLatitude();

By view helper:

Returns city name for current IP:

<?php echo $this->geoip() ?>

Returns country name for given IP:

<?php echo $this->geoip('184.106.35.179')->getCountryName() ?>

You can also implements \ZfSnapGeoip\IpAwareInterface interface and then use instance in service/helper:

<?php echo $this->geoip($user)->getTimezone() ?>

Avaliable getter methods via \ZfSnapGeoip\Entity\Record:

getAreaCode()
getCity()
getContinentCode()
getCountryCode()
getCountryCode3()
getCountryName()
getDmaCode()
getLatitude()
getLongitude()
getMetroCode()
getPostalCode()
getRegion()
getRegionName()
getTimezone()

Events

Module supports \Zend\EventManager.

Class Event name Description Params
ZfSnapGeoip\Controller\ConsoleController downloadAction.exists If no-clobber is enabled and file exists path (to dat file)
ZfSnapGeoip\Controller\ConsoleController downloadAction.pre Before unzip file path (to dat file), response (gziped response object)
ZfSnapGeoip\Controller\ConsoleController downloadAction.post After unzip file path (to dat file)
ZfSnapGeoip\Service\Geoip getIp After read IP ip (ip address)
ZfSnapGeoip\Service\Geoip getRecord After created record record (instance of ZfSnapGeoip\Entity\RecordInterface)
ZfSnapGeoip\Service\Geoip getRegions After first loading regions names regions

How to install?

Via composer.json

{
    "require": {
        "snapshotpl/zf-snap-geoip": "2.*"
    }
}

and add ZfSnapGeoip module name to application.config.php

To download data file from http://dev.maxmind.com/geoip/legacy/geolite/ use Zend\Console (you can add this to crontab):

php index/public.php geoip download

Or use autoupdate database during install/update in composer (just add this lines to composer.json and run composer):

{
    "scripts": {
        "post-install-cmd": [
            "ZfSnapGeoip\\Composer\\ScriptHandler::downloadData"
        ],
        "post-update-cmd": [
            "ZfSnapGeoip\\Composer\\ScriptHandler::downloadData"
        ]
    }
}

Console usage

You can download GeoIP database from application console:

php public/index.php geoip download

There are optional parameters:

  • --no-clobber Don't overwrite an existing db file,
  • -q Turn off output,
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].