https://github.com/drago-ex/parameters
:open_file_folder: A simple Nette extension for accessing common directory paths (appDir, wwwDir, tempDir) in your application via dependency injection.
https://github.com/drago-ex/parameters
nette parameters
Last synced: 4 months ago
JSON representation
:open_file_folder: A simple Nette extension for accessing common directory paths (appDir, wwwDir, tempDir) in your application via dependency injection.
- Host: GitHub
- URL: https://github.com/drago-ex/parameters
- Owner: drago-ex
- License: mit
- Created: 2015-10-16T05:54:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-01-24T11:48:30.000Z (5 months ago)
- Last Synced: 2025-01-24T12:27:32.221Z (5 months ago)
- Topics: nette, parameters
- Language: PHP
- Homepage:
- Size: 140 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
## 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.[](https://raw.githubusercontent.com/drago-ex/parameters/master/license.md)
[](https://badge.fury.io/ph/drago-ex%2Fparameters)
[](https://github.com/drago-ex/parameters/actions/workflows/tests.yml)
[](https://github.com/drago-ex/parameters/actions/workflows/coding-style.yml)
[](https://www.codefactor.io/repository/github/drago-ex/parameters)
[](https://coveralls.io/github/drago-ex/parameters?branch=master)## Technology
- PHP 8.3 or higher
- 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.
```neon
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:
```php
$this->appDir;
```## Public Directory
To get the path to your public directory (e.g., the `www` or `public` directory):
```php
$this->wwwDir;
```## Temporary Directory
To get the path to the temporary directory (where cache or logs might be stored):
```php
$this->tempDir;
```