PHPackages                             b13/magnets - 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. [API Development](/categories/api)
4. /
5. b13/magnets

ActiveTypo3-cms-extension[API Development](/categories/api)

b13/magnets
===========

Magnets: TYPO3 Service Package revolving around having a good API to fetch the current Geo IP and its location of the user.

3.0.1(7mo ago)429.3k↓19.8%3[1 issues](https://github.com/b13/magnets/issues)[1 PRs](https://github.com/b13/magnets/pulls)GPL-2.0-or-laterPHP

Since Feb 7Pushed 3mo ago10 watchersCompare

[ Source](https://github.com/b13/magnets)[ Packagist](https://packagist.org/packages/b13/magnets)[ RSS](/packages/b13-magnets/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (2)Versions (17)Used By (0)

TYPO3 Extension "magnets"
=========================

[](#typo3-extension-magnets)

This extension acts as a thin wrapper for TYPO3 to access GeoIP relevant information.

A symfony CLI Command can be added to download the latest GeoIP2 data.

For download the latest GeoIP2 data you have to provide an licence-key from [maxmind](https://www.maxmind.com/en/geolite2/signup)(as .env-Variable or `$GLOBALS['TYPO3_CONF_VARS']['SYS']['GeoIPLicenceKey']`)

Maxmind API requests are limited (1000 requests/day). As an alternative the databases (GeoLite2-City, GeoLite2-Country) can be stored as a "Generic Package" in GitLab.

For Download during the CI run the `CI_JOB_TOKEN` can be used as follows:

```
if (!empty(getenv('CI_JOB_TOKEN'))) {
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['GeoIPSource']['url'] = 'https:///api/v4/projects//packages/generic/GeoLite2/1.0.0/###REMOTE_EDITION###.tar.gz';
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['GeoIPSource']['headers'] = [
        'JOB-TOKEN' => getenv('CI_JOB_TOKEN'),
    ];
}
```

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

[](#installation)

Run `composer req b13/magnets` and install the extension via Extension Manager.

Usage
-----

[](#usage)

Ensure your cronjob / scheduler task is running and use the IpLocation PHP class to have a nice and quick API.

In addition, you have "countryCode" as TypoScript condition available.

```
[countryCode == 'FR']
  page.10 = TEXT
  page.10.value = You are from france
[global]

```

The condition is also available in site configurations.

Settings
--------

[](#settings)

Headers to send while running the request to download the database. Either use `JOB-TOKEN` or `PRIVATE-TOKEN` to [authenticate on GitLab](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html).

```
$GLOBALS['TYPO3_CONF_VARS']['SYS']['GeoIPSource']['headers'] = [];
```

Change the URL to retrieve the databases from. The URL needs to include `###REMOTE_EDITION###` which will be replaced by the "remote edition" (GeoLite2-Country and GeoLite2-City).

```
$GLOBALS['TYPO3_CONF_VARS']['SYS']['GeoIPSource']['url'] = 'https://download.maxmind.com/app/geoip_download?suffix=tar.gz&edition_id=###REMOTE_EDITION###';
```

Store and Update databases using GitLab
---------------------------------------

[](#store-and-update-databases-using-gitlab)

Create a project and add a `.gitlab-ci.yml`

```
stages:
  - package-update

geo-ip:
  stage: package-update
  image: alpine/curl:8.9.1
  variables:
    GIT_STRATEGY: none
    GITLAB_RELEASE_VERSION: "1.0.0"
    PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/GeoLite2"
  script:
    # Download Maxmind GeoIP database
    - mkdir -p downloads
    - curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${GEOIP_LICENCE_KEY}&suffix=tar.gz" > downloads/GeoLite2-Country.tar.gz
    - curl -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${GEOIP_LICENCE_KEY}&suffix=tar.gz" > downloads/GeoLite2-City.tar.gz
    # Upload files to package
    - 'curl --fail-with-body --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ./downloads/GeoLite2-Country.tar.gz ${PACKAGE_REGISTRY_URL}/${GITLAB_RELEASE_VERSION}/GeoLite2-Country.tar.gz'
    - 'curl --fail-with-body --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ./downloads/GeoLite2-City.tar.gz ${PACKAGE_REGISTRY_URL}/${GITLAB_RELEASE_VERSION}/GeoLite2-City.tar.gz'
```

Under Settings -&gt; CI/CD -&gt; Variables add a variable named "GEOIP\_LICENCE\_KEY" containing the licence-key.

For regular updates add a "New schedule" und Build -&gt; Pipeline schedules. e.g. `8 00 * * 1,3`

License
-------

[](#license)

Just as TYPO3 Core, this is an extension for TYPO3 and also licensed under GPL2+.

---

*Made by [b13](https://b13.com) with ♥*

[Find more TYPO3 extensions we have developed](https://b13.com/useful-typo3-extensions-from-b13-to-you) that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance68

Regular maintenance activity

Popularity33

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 51% 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 ~222 days

Recently: every ~149 days

Total

11

Last Release

112d ago

Major Versions

1.2.0 → 2.0.02023-09-04

2.2.0 → 3.0.02025-05-28

3.0.1 → v14.x-dev2026-03-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/165630?v=4)[Benni Mack](/maintainers/bmack)[@bmack](https://github.com/bmack)

![](https://avatars.githubusercontent.com/u/2851821?v=4)[b13 GmbH](/maintainers/b13)[@b13](https://github.com/b13)

![](https://avatars.githubusercontent.com/u/7824856?v=4)[Daniel Goerz](/maintainers/ervaude)[@ervaude](https://github.com/ervaude)

![](https://www.gravatar.com/avatar/a5d1eaee245843d7bd131ea73d9037f3473a857db20a5ddcf880838a70107459?d=identicon)[achimfritz](/maintainers/achimfritz)

---

Top Contributors

[![bmack](https://avatars.githubusercontent.com/u/165630?v=4)](https://github.com/bmack "bmack (26 commits)")[![ervaude](https://avatars.githubusercontent.com/u/7824856?v=4)](https://github.com/ervaude "ervaude (10 commits)")[![achimfritz](https://avatars.githubusercontent.com/u/2152991?v=4)](https://github.com/achimfritz "achimfritz (4 commits)")[![jschlier](https://avatars.githubusercontent.com/u/9108576?v=4)](https://github.com/jschlier "jschlier (4 commits)")[![ochorocho](https://avatars.githubusercontent.com/u/4623070?v=4)](https://github.com/ochorocho "ochorocho (2 commits)")[![liayn](https://avatars.githubusercontent.com/u/222377?v=4)](https://github.com/liayn "liayn (2 commits)")[![b13-michaelsemle](https://avatars.githubusercontent.com/u/23473071?v=4)](https://github.com/b13-michaelsemle "b13-michaelsemle (1 commits)")[![ftrojahn](https://avatars.githubusercontent.com/u/6184818?v=4)](https://github.com/ftrojahn "ftrojahn (1 commits)")[![davidsteeb](https://avatars.githubusercontent.com/u/3862523?v=4)](https://github.com/davidsteeb "davidsteeb (1 commits)")

### Embed Badge

![Health badge](/badges/b13-magnets/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[hn/typo3-mcp-server

TYPO3 extension that provides a Model Context Protocol (MCP) server for interacting with TYPO3 pages and records

8523.4k1](/packages/hn-typo3-mcp-server)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

611.1M8](/packages/netresearch-rte-ckeditor-image)[pagemachine/searchable

TYPO3 extension to index and search content with Elasticsearch

1039.9k](/packages/pagemachine-searchable)[thieleundklose/autotranslate

This extension provides automatic translation of pages and content elements via DeepL API.

1213.7k](/packages/thieleundklose-autotranslate)

PHPackages © 2026

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