drago-ex / parameters
A simple Nette extension for accessing common directory paths (appDir, wwwDir, tempDir) in your application via dependency injection.
v2.0.4
2026-10-29 15:27 UTC
Requires
- php: >=8.3 <9
- nette/di: ^3.1
Requires (Dev)
- nette/tester: ^2.5
- phpstan/phpstan-nette: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A lightweight extension for managing application directory paths (such as application, public, and temporary directories) within a Nette-based project. Provides a simple way to access these paths via dependency injection.
Requirements
- PHP >= 8.3, < 9
- Nette Framework
- Composer
Installation
composer require drago-ex/parameters
Extension Registration
Register the extension in your neon configuration and pass the directories:
extensions: - Drago\Parameters\DI\ParametersExtension(appDir: %appDir%, wwwDir: %wwwDir%, tempDir: %tempDir%)
The extension registers one service, Drago\Parameters\Parameters, which holds the three paths.
Accessing Directories in Your Application
Inject the Parameters service wherever you need the paths:
use Drago\Parameters\Parameters; final class ImageStorage { public function __construct( private readonly Parameters $parameters, ) { } public function getUploadDir(): string { return $this->parameters->wwwDir . '/uploads'; } }
appDir- the application directory (usuallyapp/).wwwDir- the public directory (www/orpublic/).tempDir- the temporary directory for cache and similar files.