Skip to content

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

License

Notifications You must be signed in to change notification settings

drago-ex/parameters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drago Parameters

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 CodeFactor Coverage Status

Requirements

  • PHP >= 8.3
  • Nette Framework
  • Composer

Installation

composer require drago-ex/parameters

Extension registration

To enable the Parameters extension in your Nette project, add the following configuration to your neon file. This registers the ParametersExtension and injects paths to the application, public, and temporary directories.

extensions:
	- Drago\Parameters\DI\ParametersExtension(appDir: %appDir%, wwwDir: %wwwDir%, tempDir: %tempDir%)

This will automatically inject the directory paths as services into your project.

Accessing Directories in Your Application

Once registered, you can access the directory paths throughout your application using the following properties:

Application Directory

To get the path to your application's directory (usually the root directory of your app), use:

$this->appDir;

Public Directory

To get the path to your public directory (e.g., the www or public directory):

$this->wwwDir;

Temporary Directory

To get the path to the temporary directory (where cache or logs might be stored):

$this->tempDir;

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages