PHPackages                             wpbones/geolocalizer - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. wpbones/geolocalizer

ActiveLibrary[Localization &amp; i18n](/categories/localization)

wpbones/geolocalizer
====================

Geo provider for WP Bones

1.0.1(1y ago)075MITPHP

Since Feb 3Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/wpbones/geolocalizer)[ Packagist](https://packagist.org/packages/wpbones/geolocalizer)[ Docs](https://github.com/wpbones/geolocalizer)[ RSS](/packages/wpbones-geolocalizer/feed)WikiDiscussions main Synced 2mo ago

READMEChangelogDependenciesVersions (15)Used By (0)

Geo Localizer packager for WP Bones
===================================

[](#geo-localizer-packager-for-wp-bones)

[![Latest Stable Version](https://camo.githubusercontent.com/e79775babe7ae1083079925a3a9790a00171026b892fc974c6c14aa26106d587/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f67656f6c6f63616c697a65722f762f737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/geolocalizer) [![Latest Unstable Version](https://camo.githubusercontent.com/ccef7dce8ad055fe87a0c8ae13160a8d264cf624cee3906b3550bdc2c58cccc3/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f67656f6c6f63616c697a65722f762f756e737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/geolocalizer) [![Total Downloads](https://camo.githubusercontent.com/36f9b42eda942b1e78b2861bc9b9d53ebafb1b3a5e35e2de1caade04c2672699/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f67656f6c6f63616c697a65722f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/geolocalizer) [![License](https://camo.githubusercontent.com/36193367ac663a0dfc996088a4a1070eba1a0ec365631257917abdfbd35d660a/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f67656f6c6f63616c697a65722f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/geolocalizer) [![Monthly Downloads](https://camo.githubusercontent.com/d5c495f21eaedddf12a9212801200eb7ad79503a30273eda9cbc28c54b4eedbf/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f67656f6c6f63616c697a65722f642f6d6f6e74686c793f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/geolocalizer)

Geo Localizer provides a set of utilities to manage geolocation for WordPress/WP Bones

Requirements
------------

[](#requirements)

This package works with a WordPress plugin written with [WP Bones framework library](https://github.com/wpbones/WPBones).

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

[](#installation)

You can install third party packages by using:

```
php bones require wpbones/geolocalizer
```

I advise to use this command instead of `composer require` because doing this an automatic renaming will done.

You can use composer to install this package:

```
composer require wpbones/geolocalizer
```

You may also to add `"wpbones/geolocalizer": "^1.0"` in the `composer.json` file of your plugin:

```
  "require": {
    "php": ">=7.4",
    "wpbones/wpbones": "~0.8",
    "wpbones/geolocalizer": "~1.0"
  },
```

and run

```
composer install
```

Alternatively, you can get the single files `src/resources/assets/js/actions-and-filters.js` in your WP Bones plugin and compile it with `gulp`. Also, you can get pre-compiled minified version `src/public/js/actions-and-filters.min.js`.

Migration
---------

[](#migration)

In the `database/migrations` you'll find the default migration database table used for the countries. Also. in the `database/seeders` you'll find the data for countries database table.

Anyway, you just copy these folders in your plugin `database/` folder.

Geo services
------------

[](#geo-services)

This version is using the [IPStack](https://ipstack.com/) service to get the country code and the rest of the data. You have to create an account in IPStack and get your API key. In your plugin you may use the API key b yusing the filter:

```
add_filter('wpbones_geolocalizer_ipstack_api_key', function () {
    // get your api key rom your settings
    // for example, MyPlugin::$plugin->options->get('General/ipstack_api_key');
    return $your_api_key;
});
```

Testing
-------

[](#testing)

In order to check if your API key is valid you can use the following command:

```
$info = MyPlugin\GeoLocalizer\GeoLocalizerProvider::geoIP();
```

You should receive all information starting from your IP address. Otherwise, you'll receive an error from IPStack service.

Shortcode
---------

[](#shortcode)

Geolocalizer provides a shortcode method. You can define you own shortcode in the your shortcode provider class:

```
use WPMyPlugin\WPBones\Foundation\WordPressShortcodesServiceProvider as ServiceProvider;
use WPMyPlugin\GeoLocalizer\GeoLocalizerProvider;

class WPMyPluginShortcode extends ServiceProvider
{

  /**
   * List of registred shortcodes. {shortcode}/method
   *
   * @var array
   */
  protected $shortcodes = [
    'my_shortocde_geo' => 'my_shortocde_geo',
  ];

  public function my_shortocde_geo( $atts = [], $content = null )
  {
    return GeoLocalizerProvider::shortcode( $atts, $content );
  }
```

The you can use:

```
[my_shortocde_geo city="Rome"]
  Only for Rome
[/my_shortocde_geo]
```

```
[my_shortocde_geo city="rome"]
  Only for Rome
[/my_shortocde_geo]
```

```
[my_shortocde_geo city="rome,london"]
  Only for Rome and Landon
[/my_shortocde_geo]
```

```
[my_shortocde_geo region_name="lazio"]
  Only for region (Italy) Lazio
[/my_shortocde_geo]
```

```
[my_shortocde_geo country_code="IT"]
  Italian only
[/my_shortocde_geo]
```

```
[my_shortocde_geo country_name="italy"]
  Italian only
[/my_shortocde_geo]
```

```
[my_shortocde_geo zip_code="00137"]
  Wow
[/my_shortocde_geo]
```

```
[my_shortocde_geo ip="80.182.82.82"]
  Only for me
[/my_shortocde_geo]
```

```
[my_shortocde_geo time_zone="europe\rome"]
  Rome/Berlin time zone
[/my_shortocde_geo]
```

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance44

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~233 days

Recently: every ~48 days

Total

13

Last Release

590d ago

Major Versions

0.8.2 → 1.0.02024-09-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/3eb65ad928faf1a3303497a2f9e3bb8db51ebcb09dc21c6ddc3546b4bdc9c2b4?d=identicon)[gfazioli](/maintainers/gfazioli)

---

Top Contributors

[![gfazioli](https://avatars.githubusercontent.com/u/432181?v=4)](https://github.com/gfazioli "gfazioli (18 commits)")

---

Tags

geocodinggeolocationwordpresswordpress-developmentwordpress-pluginwp-boneswp-bones-packageslocalizationcountriesgeoWP Bones

### Embed Badge

![Health badge](/badges/wpbones-geolocalizer/health.svg)

```
[![Health](https://phpackages.com/badges/wpbones-geolocalizer/health.svg)](https://phpackages.com/packages/wpbones-geolocalizer)
```

###  Alternatives

[symfony/intl

Provides access to the localization data of the ICU library

2.6k199.8M1.1k](/packages/symfony-intl)[commerceguys/addressing

Addressing library powered by CLDR and Google's address data.

95430.2M43](/packages/commerceguys-addressing)[menarasolutions/geographer

A PHP library that knows how any country, state or city is called in any language

765733.1k4](/packages/menarasolutions-geographer)[gettext/languages

gettext languages with plural rules

7530.3M11](/packages/gettext-languages)[macmotp/locale

A curated library to handle locale in PHP

507.1k](/packages/macmotp-locale)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
