Download the PHP package netresearch/contexts without Composer
On this page you can find all versions of the php package netresearch/contexts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download netresearch/contexts
More information about netresearch/contexts
Files in netresearch/contexts
Package contexts
Short Description Multi-channel content visibility for TYPO3 - by Netresearch
License AGPL-3.0-or-later
Homepage https://github.com/netresearch/t3x-contexts/
Informations about the package contexts
Multi-channel Contexts for TYPO3
Content visibility control for TYPO3 based on configurable contexts
Show and hide pages and content elements based on configurable "contexts". With the use of contexts, TYPO3 is able to do multichannel output.
Requirements
| Version | TYPO3 | PHP |
|---|---|---|
| 5.x | 13.4, 14.3 | 8.2 - 8.5 |
| 4.x | 12.4, 13.4 | 8.2 - 8.5 |
| 3.x | 11.5 | 7.4 - 8.1 |
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 < 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
- Setup
- Creating and Using Contexts
- Context Types
- Integration
- Development
Setup
- Install and activate extension
contexts - Clear TYPO3 cache
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 a Context
- Log into the TYPO3 backend as administrator
- Go to Web/List view, root page (ID 0)
- Create a new record: TYPO3 contexts → Context
- Configure:
- Title: e.g., "Affiliate ID: foo"
- Type: "GET parameter"
- Parameter name:
affID - Parameter value:
foo - Enable "Store result in user session"
- Save and close
Using a Context
- Go to Web/Page, select a page
- Edit a content element
- Select the "Contexts" tab
- For your context, select "Visible: yes"
- Save
The content element is now only visible when the context matches.
Context Types
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.orgmatcheswww.example.org)
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
Match the user's IP address. IPv4 and IPv6 supported.
HTTP Header
Match HTTP request headers (User-Agent, Accept-Language, X-Forwarded-For, etc.)
- The header is evaluated on every request; "Store result in user session" has no effect for this type
- Leave value empty to match any non-empty header value
Session Variable
Match based on session data. Checks if a session variable with the given name exists.
Logical Combination
Combine multiple contexts with logical operators:
| Operator | Description |
|---|---|
&& |
Logical AND |
|| |
Logical OR |
! |
Negation |
(...) |
Grouping |
Example: mobile && !tablet
Integration
Fluid Templates
TypoScript Conditions
PHP API
Development
Testing
Code Quality
| Tool | Version | Purpose |
|---|---|---|
| PHPUnit | 10/11/12/13 | Unit and functional tests |
| PHPStan | 2.x | Static analysis (level 10) |
| PHP-CS-Fixer | 3.x | Code style (PSR-12) |
Documentation
Full documentation available at docs.typo3.org.
License
This project is licensed under the AGPL-3.0-or-later.
Credits
Developed and maintained by Netresearch DTT GmbH.
Contributors: Andre Hähnel, Christian Opitz, Christian Weiske, Marian Pollzien, Rico Sonntag, Benni Mack, and others.
All versions of contexts with dependencies
ext-pdo Version *
typo3/cms-backend Version ^13.4 || ^14.3
typo3/cms-core Version ^13.4 || ^14.3
typo3/cms-frontend Version ^13.4 || ^14.3