Skip to content

Commit

Permalink
Readme: document pluggable bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Jun 29, 2017
1 parent aaa00f2 commit 0214664
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .docs/README.md
Expand Up @@ -3,6 +3,7 @@
## Content

- [ExtraConfigurator - bootstraping](#extraconfigurator)
- [PluggableConfigurator - plugin system](#pluggableconfigurator)

## ExtraConfigurator

Expand Down Expand Up @@ -93,3 +94,29 @@ You can manage debug modes over `NETTE_DEBUG` variable.
- `NETTE_DEBUG`: 0
- `NETTE_DEBUG`: 10.0.0.10
- `NETTE_DEBUG`: cookie@10.0.0.10

## PluggableConfigurator

There's a need to organize bulk of codes together, we call them plugins. Official `Nette\Configurator` does not support
any type of plugin, so `PluggableConfigurator` was created.

```php
use Contributte\Bootstrap\PluggableConfigurator;

$pluggable = new PluggableConfigurator();

$pluggable->addPlugin(new MyBeforeContainerIsLoadedPlugin());
$pluggable->addPlugin(new SpecialOnlyInDebugModePlugin());
```

You can easilly add a new plugin via `addPlugin($plugin)` method.

There are some types of plugin.

| Plugin | Triggers | Arguments | Mode |
|-------------------------|----------------------------|-------------------------|-------|
| `IConfigurationPlugin` | before `createContainer` | Configurator | ALL |
| `IContainerPlugin` | after `createContainer` | Configurator, Container | ALL |
| `IDebugContainerPlugin` | after `createContainer` | Configurator, Container | DEBUG |
| `ICompilerPlugin` | during `generateContainer` | Configurator, Compiler | ALL |
| `IDebugCompilerPlugin` | during `generateContainer` | Configurator, Compiler | DEBUG |
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -32,7 +32,8 @@ composer require contributte/bootstrap

## Overview

- [ExtraConfigurator - bootstrap](https://github.com/contributte/bootstrap/blob/master/.docs/README.md#bootstrap)
- [ExtraConfigurator - bootstrap](https://github.com/contributte/bootstrap/blob/master/.docs/README.md#extraconfigurator)
- [PluggableConfigurator - pluggable](https://github.com/contributte/bootstrap/blob/master/.docs/README.md#pluggableconfigurator)

---

Expand Down

0 comments on commit 0214664

Please sign in to comment.