Download the PHP package mteu/typo3-typed-extconf without Composer
On this page you can find all versions of the php package mteu/typo3-typed-extconf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mteu/typo3-typed-extconf
More information about mteu/typo3-typed-extconf
Files in mteu/typo3-typed-extconf
Package typo3-typed-extconf
Short Description Aims to provide a type-safe extension configuration management for TYPO3, ensuring proper types instead of string-only values from backend configuration or mixed types from config/system/settings.php
License GPL-2.0-or-later
Informations about the package typo3-typed-extconf
This TYPO3 CMS extension aims to provide a type-safe extension configuration
management for TYPO3, ensuring proper types instead of string-only values from
backend configuration or mixed types from config/system/settings.php|additional.php
(or custom solutions around those).
[!WARNING] This extension is in a testing and review phase and hence marked
beta
. Be cautious when using this in production environments.
π Features
- Type Safety: Automatic conversion from TYPO3's string configuration to proper PHP types
- Schema Definition: Define configuration using PHP attributes and constructor parameters
- Path Mapping: Support for nested configuration with dot notation (
api.endpoint
) - Configuration Generation: Generate classes from
ext_conf_template.txt
or interactively - Dependency Injection: Configuration classes auto-registered as services
β‘οΈ Installation
Add this package to your TYPO3 Extension:
This extension relies heavily on these key dependencies:
cuyz/valinor
for type-safe object mapping and validationnette/phpgenerator
for PHP code generation for configuration classessymfony/console
for the automated (or interactive) code generation
π‘ Usage
[!TIP] For a comprehensive developer guide with advanced examples and best practices, check out the Developer Guide.
[!NOTE] If you're in a hurry you might want to have this package generate configuration classes automatically based on your extension's
ext_conf_template.txt
.Run
./vendor/bin/typo3 typed-extconf:generate
or consult the Command Guide.Use with caution, though, since this functionality is not well tested, yet.
1. Define Configuration Schema
Create a configuration class for your extension using PHP attributes:
2. Access Typed Configuration
Option A: Direct Injection (Recommended)
Directly inject your configuration object using dependency injection:
Option B: Using the Provider
Alternatively, use the configuration provider service:
π Attribute Reference
#[ExtensionConfig]
Class-level attribute to specify which TYPO3 extension the configuration belongs to.
Parameters:
extensionKey
(string, required): The TYPO3 extension key.
#[ExtConfProperty]
Property/parameter-level attribute for configuration value mapping.
Parameters:
path
(string, optional): Custom configuration path using dot notation (e.g., 'api.endpoint')required
(bool, optional): Whether the configuration value is required (default: false)
[!NOTE] Default values are defined as PHP constructor parameter defaults, not in the attribute.
How It Works
TYPO3 stores extension configuration in $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']
as an associative array with
string values. Those strings could be manually altered by the developers to other types.
This extension automatically converts those types to proper PHP types using your configuration class schema.
π§βπ» Real-world example with nested configuration
π Credits
This project is built on the excellent CuyZ\Valinor library, which provides the core type mapping and validation functionality. Without Valinor's robust object mapping capabilities, this extension would not be possible.
Special thanks to:
- CuyZ\Valinor for the powerful and flexible object mapping engine
- Romain Canon and the Valinor contributors for their excellent work
- Elias HΓ€uΓler for his extensive help reviewing this extension and
contributing substantial improvements. Be sure to check out his Composer
packages β
PHPUnit Attributes
andVersion Bumper
β both of which greatly simplify maintaining this project.
π€ Contributing
Contributions are very welcome! Please have a look at the Contribution Guide. It lays out the workflow of submitting new features or bugfixes.
π Security
Please refer to our security policy if you discover a security vulnerability in this extension. Be warned, though. I cannot afford bounty. This is private project.
β License
This extension is licensed under the GPL-2.0-or-later license.
π¬ Support
For issues and feature requests, please use the GitHub issue tracker.
All versions of typo3-typed-extconf with dependencies
ext-filter Version *
cuyz/valinor Version ^2.0
nette/php-generator Version ^4.1.6
symfony/console Version ^6.4 || ^7.0
typo3/cms-core Version ~12.4.37 || ~13.4.18