PHPackages                             netresearch/contexts - 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. netresearch/contexts

ActiveTypo3-cms-extension[Utility &amp; Helpers](/categories/utility)

netresearch/contexts
====================

Multi-channel content visibility for TYPO3 - by Netresearch

v4.0.0(4mo ago)1119.0k↓88.6%11[2 issues](https://github.com/netresearch/t3x-contexts/issues)1AGPL-3.0-or-laterPHPPHP ^8.2CI passing

Since Jan 10Pushed 1mo ago11 watchersCompare

[ Source](https://github.com/netresearch/t3x-contexts)[ Packagist](https://packagist.org/packages/netresearch/contexts)[ Docs](https://github.com/netresearch/t3x-contexts/)[ RSS](/packages/netresearch-contexts/feed)WikiDiscussions main Synced yesterday

READMEChangelog (7)Dependencies (34)Versions (14)Used By (1)

 [ ![Netresearch](Resources/Public/Icons/Extension.svg) ](https://www.netresearch.de/)

Multi-channel Contexts
======================

[](#multi-channel-contexts)

 **Content visibility control for TYPO3 based on configurable contexts**

 [![CI](https://github.com/netresearch/t3x-contexts/actions/workflows/ci.yml/badge.svg)](https://github.com/netresearch/t3x-contexts/actions/workflows/ci.yml) [![Codecov](https://camo.githubusercontent.com/23e3fdcb1d1b608d2238663e529cf74fed772a021e6d0271edf710fe6d8652f0/68747470733a2f2f636f6465636f762e696f2f67682f6e657472657365617263682f7433782d636f6e74657874732f67726170682f62616467652e737667)](https://codecov.io/gh/netresearch/t3x-contexts) [![Documentation](https://github.com/netresearch/t3x-contexts/actions/workflows/docs.yml/badge.svg)](https://github.com/netresearch/t3x-contexts/actions/workflows/docs.yml) [![OpenSSF Scorecard](https://camo.githubusercontent.com/186ec2d18b50a5df74e7e5d365b19ca861393f1bef7f65dc8972cbadf9de289a/68747470733a2f2f6170692e73636f7265636172642e6465762f70726f6a656374732f6769746875622e636f6d2f6e657472657365617263682f7433782d636f6e74657874732f6261646765)](https://scorecard.dev/viewer/?uri=github.com/netresearch/t3x-contexts) [![OpenSSF Best Practices](https://camo.githubusercontent.com/6b52198986f8c7bd05108a56d67ff5019725e6090556921807d9036138d6a766/68747470733a2f2f7777772e626573747072616374696365732e6465762f70726f6a656374732f31313835342f6261646765)](https://www.bestpractices.dev/projects/11854) [![PHPStan](https://camo.githubusercontent.com/d18b9a987aa81e64470a11caecf72caa66597c9ebd6b307bd1c2cb7a752b0dff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e2e737667)](https://phpstan.org/) [![PHP 8.2-8.5](https://camo.githubusercontent.com/b7d44ae9f4cbacfd269643c08879a6f619b0b8f70aa9f588769d878ee17b6653/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d2d382e352d626c75652e737667)](https://www.php.net/) [![TYPO3 v12 | v13](https://camo.githubusercontent.com/f95a4baa76b73a9be0393ebf030c71b9d997cf07394f7ec105f5d3ca20bd8e51/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d7631322532302537432532307631332d6f72616e67652e737667)](https://typo3.org/) [![License](https://camo.githubusercontent.com/825f493e8a5a627d7ad9e10c8de5036aec21230e060b351eaafd02e672e73319/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e657472657365617263682f7433782d636f6e7465787473)](LICENSE) [![Latest Release](https://camo.githubusercontent.com/30a42309655d03a97d413cd6f77cf474db575467220a61cd8afea710e4d9bac5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6e657472657365617263682f7433782d636f6e74657874733f736f72743d73656d766572)](https://github.com/netresearch/t3x-contexts/releases) [![Contributor Covenant](https://camo.githubusercontent.com/29a162993634c8b29ac484c10c05c2db4be4e6ea7a916cf5c130711e91d26364/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72253230436f76656e616e742d322e302d3462616161612e737667)](CODE_OF_CONDUCT.md) [![SLSA 3](https://camo.githubusercontent.com/dc294f15fb5f1c96307863a1e96860310be940504e7ee370cee94bf4400cbac9/68747470733a2f2f736c73612e6465762f696d616765732f67682d62616467652d6c6576656c332e737667)](https://slsa.dev)

---

Show and hide pages and content elements based on configurable "contexts". With the use of contexts, TYPO3 is able to do multichannel output.

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

[](#requirements)

VersionTYPO3PHP4.x12.4, 13.48.2 - 8.53.x11.57.4 - 8.1Context Examples
----------------

[](#context-examples)

- User IP matches a given rule
- User entered website with GET-Parameter `affID=foo`
- Domain the user visits
- HTTP header values (User-Agent, Accept-Language, etc.)
- A session variable is set
- A combination of any other rules

**With companion extensions:**

- Screen size &lt; 500px (`contexts_wurfl`)
- Browser runs on a tablet or mobile phone (`contexts_wurfl`)
- Location is 15km around a certain place (`contexts_geolocation`)
- User is from one of certain countries (`contexts_geolocation`)

Apart from the context rules, this extension also provides an API to use contexts in your own extensions.

Table of Contents
-----------------

[](#table-of-contents)

- [Setup](#setup)
- [Creating and Using Contexts](#creating-and-using-contexts)
- [Context Types](#context-types)
- [Integration](#integration)
- [Development](#development)

Setup
-----

[](#setup)

1. Install and activate extension `contexts`
2. Clear TYPO3 cache

```
composer require netresearch/contexts
vendor/bin/typo3 extension:activate contexts
vendor/bin/typo3 cache:flush
vendor/bin/typo3 database:updateschema
```

**Optional Extensions:**

- `contexts_geolocation` - Location-based rules (continent, country, area)
- `contexts_wurfl` - Device-based rules (phone, tablet, TV, screen sizes)

Creating and Using Contexts
---------------------------

[](#creating-and-using-contexts)

### Creating a Context

[](#creating-a-context)

1. Log into the TYPO3 backend as administrator
2. Go to Web/List view, root page (ID 0)
3. Create a new record: TYPO3 contexts → Context
4. Configure:
    - Title: e.g., "Affiliate ID: foo"
    - Type: "GET parameter"
    - Parameter name: `affID`
    - Parameter value: `foo`
    - Enable "Store result in user session"
5. Save and close

### Using a Context

[](#using-a-context)

1. Go to Web/Page, select a page
2. Edit a content element
3. Select the "Contexts" tab
4. For your context, select "Visible: yes"
5. Save

The content element is now only visible when the context matches.

Context Types
-------------

[](#context-types)

### Domain

[](#domain)

Match based on the accessed domain name.

- One domain per line
- Without leading dot: exact match only (`www.example.org` ≠ `example.org`)
- With leading dot: matches all subdomains (`.example.org` matches `www.example.org`)

### Query Parameter

[](#query-parameter)

Match based on URL query parameters.

- Enable "Store result in user session" to persist across pages
- Leave value empty to match any non-empty parameter value

### IP Address

[](#ip-address)

Match the user's IP address. IPv4 and IPv6 supported.

```
80.76.201.32          # Full address
80.76.201.32/27       # CIDR notation
FE80::/16             # IPv6 prefix
80.76.201.*           # Wildcard
80.76.*.*             # Multiple wildcards

```

### HTTP Header

[](#http-header)

Match HTTP request headers (User-Agent, Accept-Language, X-Forwarded-For, etc.)

- Enable "Store result in user session" to persist across pages
- Leave value empty to match any non-empty header value

### Session Variable

[](#session-variable)

Match based on session data. Checks if a session variable with the given name exists.

### Logical Combination

[](#logical-combination)

Combine multiple contexts with logical operators:

OperatorDescription`&&`Logical AND``!`Negation`(...)`GroupingExample: `mobile && !tablet`

Integration
-----------

[](#integration)

### Fluid Templates

[](#fluid-templates)

```

        Mobile content
        Desktop content

```

### TypoScript Conditions

[](#typoscript-conditions)

```
[contextMatch('mobile')]
    page.10.template = EXT:site/Resources/Private/Templates/Mobile.html
[END]

```

### PHP API

[](#php-api)

```
use Netresearch\Contexts\Api\ContextMatcher;

if (ContextMatcher::getInstance()->matches('mobile')) {
    // Mobile-specific logic
}
```

Development
-----------

[](#development)

### Testing

[](#testing)

```
composer install

# Run unit tests
composer ci:test:php:unit

# Run functional tests (requires database)
composer ci:test:php:functional

# Run with coverage
composer test:coverage

# Docker-based testing (no local PHP needed)
./Build/Scripts/runTests.sh -s unit
./Build/Scripts/runTests.sh -s phpstan
./Build/Scripts/runTests.sh -h  # Show all options
```

### Code Quality

[](#code-quality)

```
# Static analysis (level 10)
composer ci:test:php:phpstan

# Code style check
composer ci:test:php:cgl

# Code style fix
composer ci:cgl
```

ToolVersionPurposePHPUnit10/11/12/13Unit and functional testsPHPStan2.xStatic analysis (level 10)PHP-CS-Fixer3.xCode style (PSR-12)Documentation
-------------

[](#documentation)

Full documentation available at [docs.typo3.org](https://docs.typo3.org/p/netresearch/contexts/main/en-us/).

License
-------

[](#license)

This project is licensed under the [AGPL-3.0-or-later](LICENSE).

Credits
-------

[](#credits)

Developed and maintained by [Netresearch DTT GmbH](https://www.netresearch.de/).

**Contributors:** Andre Hähnel, Christian Opitz, Christian Weiske, Marian Pollzien, Rico Sonntag, Benni Mack, and [others](https://github.com/netresearch/t3x-contexts/graphs/contributors).

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance82

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 52.2% 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 ~556 days

Recently: every ~382 days

Total

7

Last Release

124d ago

Major Versions

v1.0.0 → 2.0.02021-12-24

v2.0.1 → v3.0.02023-02-02

3.1.1 → v4.0.02026-02-28

PHP version history (2 changes)2.0.0PHP &gt;=7.3.0

v4.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151247?v=4)[Netresearch DTT GmbH](/maintainers/netresearch)[@netresearch](https://github.com/netresearch)

---

Top Contributors

[![CybotTM](https://avatars.githubusercontent.com/u/326348?v=4)](https://github.com/CybotTM "CybotTM (143 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (55 commits)")[![magicsunday](https://avatars.githubusercontent.com/u/564393?v=4)](https://github.com/magicsunday "magicsunday (21 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (18 commits)")[![copitz](https://avatars.githubusercontent.com/u/882663?v=4)](https://github.com/copitz "copitz (9 commits)")[![mbrodala](https://avatars.githubusercontent.com/u/5037116?v=4)](https://github.com/mbrodala "mbrodala (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![bmack](https://avatars.githubusercontent.com/u/165630?v=4)](https://github.com/bmack "bmack (3 commits)")[![just-tobi](https://avatars.githubusercontent.com/u/5242689?v=4)](https://github.com/just-tobi "just-tobi (3 commits)")[![achimfritz](https://avatars.githubusercontent.com/u/2152991?v=4)](https://github.com/achimfritz "achimfritz (2 commits)")[![davidsteeb](https://avatars.githubusercontent.com/u/3862523?v=4)](https://github.com/davidsteeb "davidsteeb (2 commits)")[![Thoemel42](https://avatars.githubusercontent.com/u/32194305?v=4)](https://github.com/Thoemel42 "Thoemel42 (1 commits)")

---

Tags

multi-channeltypo3-extensionextensiontypo3contexts

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/netresearch-contexts/health.svg)

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

###  Alternatives

[friendsoftypo3/content-blocks

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

103519.9k53](/packages/friendsoftypo3-content-blocks)[pagemachine/typo3-formlog

Form log for TYPO3

23238.6k8](/packages/pagemachine-typo3-formlog)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

611.1M8](/packages/netresearch-rte-ckeditor-image)[georgringer/news

News system - Versatile news system based on Extbase &amp; Fluid and using the latest technologies provided by TYPO3 CMS.

2985.3M123](/packages/georgringer-news)[eliashaeussler/typo3-form-consent

Extension for TYPO3 CMS that adds double opt-in functionality to EXT:form

1595.5k](/packages/eliashaeussler-typo3-form-consent)[friendsoftypo3/visual-editor

TYPO3 CMS Visual Editor - Brings a modern WYSIWYG editing experience to TYPO3 CMS.

576.1k2](/packages/friendsoftypo3-visual-editor)

PHPackages © 2026

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