PHPackages                             primitivesocial/ip-country - 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. primitivesocial/ip-country

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

primitivesocial/ip-country
==========================

Get's location information based on user's IP

10PHP

Since Feb 12Pushed 7y ago3 watchersCompare

[ Source](https://github.com/PrimitiveSocial/ip-country)[ Packagist](https://packagist.org/packages/primitivesocial/ip-country)[ RSS](/packages/primitivesocial-ip-country/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

IP Country plugin for Craft CMS 3.x
===================================

[](#ip-country-plugin-for-craft-cms-3x)

Get's location information based on user's IP

[![Screenshot](resources/img/plugin-logo.png)](resources/img/plugin-logo.png)

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

[](#requirements)

This plugin requires Craft CMS 3.0.0-beta.23 or later.

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

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require PrimitiveSocial/ip-country

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for IP Country.

IP Country Overview
-------------------

[](#ip-country-overview)

This get's the user's location data based on their IP address for use in Twig templates.

Configuring IP Country
----------------------

[](#configuring-ip-country)

No need! Comes ready to go out of the box.

For testing locally, you will need to test at a remote server. Running this locally will return your IP address (127.0.0.1), which will not give any data.

A simple way to get around this is to test via [Ngrok](https://ngrok.com/);

Using IP Country
----------------

[](#using-ip-country)

```
This sets the IP variable
{% set ip = craft.ipcountry.get %}

Then, you can check to see if the person is in North America
{% if ip and ip.continent_code == 'NA' %}
	What up North America!
{% endif %}

Check the city
{% if ip and ip.city == 'Lubbock' %}
	Lubbock is the best
{% endif %}

Check the state
{% if ip and ip.state == 'Texas' %}
	Texas is awesome!
{% endif %}

Check the country
{% if ip and ip.country == 'Canada' %}
	Hooray for Canada!
{% endif %}

```

IP Country Roadmap
------------------

[](#ip-country-roadmap)

Some things to do, and ideas for potential features:

- Release it

Brought to you by [Primitive Social](primitivesocial.com)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9833fa1630bcd67c1340f785eafdea467a48b3c665bcc4e59b1253e0fa400762?d=identicon)[jerredhurst](/maintainers/jerredhurst)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/primitivesocial-ip-country/health.svg)

```
[![Health](https://phpackages.com/badges/primitivesocial-ip-country/health.svg)](https://phpackages.com/packages/primitivesocial-ip-country)
```

###  Alternatives

[solspace/craft-calendar

The most powerful event management and calendaring plugin!

1830.8k1](/packages/solspace-craft-calendar)

PHPackages © 2026

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