PHPackages                             oussema/hidebycountries - 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. oussema/hidebycountries

ActiveTypo3-cms-extension

oussema/hidebycountries
=======================

Hide Content Elements depends on the frontend user country

2.0.0(6mo ago)00GPL-2.0-or-laterPHPPHP &gt;= 8.1 &lt; 8.5CI passing

Since Nov 2Pushed 6mo agoCompare

[ Source](https://github.com/xvarusx/hidebycountries)[ Packagist](https://packagist.org/packages/oussema/hidebycountries)[ Docs](https://extensions.typo3.org/extension/hidebycountries/)[ Fund](https://www.buymeacoffee.com/oussemaharrabi)[ RSS](/packages/oussema-hidebycountries/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (14)Versions (4)Used By (0)

HidebyCountries
===============

[](#hidebycountries)

[![TYPO3](https://camo.githubusercontent.com/1832c5b1fb932ae74792ede2be7a9e646fe03811e16318a2295924a2466824cd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31322532422d6f72616e67653f6c6f676f3d7479706f33)](https://typo3.org)[![License](https://camo.githubusercontent.com/99d280c5a1f6abf3596fc7a96de71d3ae1003f7e99ee55140aae35bb88ba705e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c76322d626c75652e737667)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)[![Build Status](https://camo.githubusercontent.com/bf978479ab128b0bd427d4b2d72d43790122b7a4b5cd50b6e70cb69341f57a15/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f787661727573782f686964656279636f756e74726965732f74657374732e796d6c3f6272616e63683d6d61696e)](https://github.com/xvarusx/hidebycountries/actions)

> A TYPO3 extension that lets you show or hide content elements based on visitor’s country.

Features
--------

[](#features)

- Hide or show any content element (CE) depending on visitor’s country code.
- Uses a pluggable GeoIP service API for country detection.
- Cookie-based tracking for visitor’s country for performance.
- Caching support to reduce repeated lookups.
- Optional indicator in backend page preview indicating restricted CEs.
- Compatible with TYPO3 v13.

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

[](#requirements)

- TYPO3 CMS v13
- PHP 8.1+
- MySQL / MariaDB (or supported database driver)
- Composer to install dependencies (if using Composer mode)

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

[](#installation)

#### via composer

[](#via-composer)

```
composer require oussema/hidebycountries
```

#### Manual Installation

[](#manual-installation)

1. Upload the extension folder to typo3conf/ext/hidebycountries
2. Activate the extension via the Extension Manager
3. Configure via Admin Tools → Settings → Extension Configuration → hidebycountries

---

Extension Configuration
-----------------------

[](#extension-configuration)

In the Extension Configuration you will find the following settings:

OptionsDescriptionDefault ValuesdevelopmentModeUse fixed IP for testing instead of actual client IP1publicIpAddressForTestingIP address used when development mode is active (its recomand to overwrite this)234.162.28.227classNameSpaceFully qualified class-name of the GeoIP service implementation\\Oussema\\HideByCountries\\Utility\\Apis\\AetherEpiasGeoLocationServiceshowBackendRestrictionIndicatorShow a marker in backend preview for content elements with restrictions1---

How It Works
------------

[](#how-it-works)

- A PSR-15 middleware intercepts frontend requests, detects visitor country (by IP or cookie)
- The content element filter logic (configured via EventListener) checks each CE’s tx\_hidebycountries field and either renders or hides the CE for the visitor’s country.
- If enabled, the backend preview displays a visual indicator for CEs that have country restrictions.

---

Developer Guide
---------------

[](#developer-guide)

#### Using a custom GeoIP service

[](#using-a-custom-geoip-service)

1- Extend or replace the default service by implementing the GeoLocationApiInterface. Example:

```
