Search by

drago-ex / parameters

accgit

A simple Nette extension for accessing common directory paths (appDir, wwwDir, tempDir) in your application via dependency injection.

Package info

github.com/drago-ex/parameters

pkg:composer/drago-ex/parameters

Statistics

Installs: 1 293

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.0.3 2026-10-15 14:57 UTC

This package is auto-updated.

Last update: 2026-10-19 06:36:17 UTC


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.

License: MIT PHP version Tests Coding Style

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 (usually app/).
  • wwwDir - the public directory (www/ or public/).
  • tempDir - the temporary directory for cache and similar files.