https://github.com/drago-ex/bootstrap
:rocket:The `ExtraConfigurator` class extends Nette's configuration by searching for `.neon` files across directories and caching the results, with automatic cache invalidation in development.
https://github.com/drago-ex/bootstrap
configuration nette
Last synced: about 2 months ago
JSON representation
:rocket:The `ExtraConfigurator` class extends Nette's configuration by searching for `.neon` files across directories and caching the results, with automatic cache invalidation in development.
- Host: GitHub
- URL: https://github.com/drago-ex/bootstrap
- Owner: drago-ex
- License: mit
- Created: 2017-01-31T11:05:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-01-24T09:04:30.000Z (4 months ago)
- Last Synced: 2025-03-26T03:51:17.802Z (2 months ago)
- Topics: configuration, nette
- Language: PHP
- Homepage:
- Size: 195 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
## Drago Bootstrap
`ExtraConfigurator` is a class built on top of Nette Framework's `Configurator` to simplify
loading and caching of configuration files in `.neon` format. It automatically handles
caching in development and production environments.[](https://raw.githubusercontent.com/drago-ex/bootstrap/master/license.md)
[](https://badge.fury.io/ph/drago-ex%2Fbootstrap)
[](https://github.com/drago-ex/bootstrap/actions/workflows/tests.yml)
[](https://github.com/drago-ex/bootstrap/actions/workflows/coding-style.yml)
[](https://www.codefactor.io/repository/github/drago-ex/bootstrap)
[](https://coveralls.io/github/drago-ex/bootstrap?branch=master)## Requirements
- PHP 8.3 or higher
- composer## Installation
Make sure you have Nette Framework installed in your project.
```
composer require drago-ex/bootstrap
```## Basic Usage
### Adding Configuration Files
To load configuration files from a specified directory:```php
use Drago\Bootstrap\Drago\Bootstrap\ExtraConfigurator;$configurator = new ExtraConfigurator();
// Add configuration files from the 'config' directory
$configurator->addFindConfig(__DIR__ . '/config');// Access the application (you can configure services, routing, etc.)
$app = $configurator->app();
```## Adding Multiple Directories
You can also provide multiple directories for configuration files:
```php
$configurator->addFindConfig([
__DIR__ . '/config/first',
__DIR__ . '/config/second'
]);
```## Excluding Files or Directories
You can exclude certain files or directories from being loaded:
```php
$configurator->addFindConfig(__DIR__ . '/config', 'exclude');
```
This will load all `.neon` files from the `config` directory except `exclude.neon`.## Cache Management
In development mode, the cache is invalidated after each request to allow immediate updates.
In production mode, the cache is stored without expiration unless the configuration files are modified.
```php
use Tracy\Debugger;// Enable production mode to use persistent cache
Debugger::$productionMode = true;// Cache is automatically handled and invalidated only when necessary
$configurator->addFindConfig(__DIR__ . '/config');
```