Skip to content

Commit

Permalink
Merge pull request #82 from tomphp/custom-container-doc
Browse files Browse the repository at this point in the history
Add doc for withContainerAdapter()
  • Loading branch information
tomphp authored Oct 31, 2016
2 parents 061a711 + ecd1421 commit 003a244
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ You can create your own custom file reader by implementing the
`TomPHP\ContainerConfigurator\FileReader\FileReader` interface. Once you have
created it, you can use the
`withFileReader(string $extension, string $readerClassName)` method to enable
the it
the it.

**IMPORTANT**: `withFileReader()` must be called before calling
`configFromFile()` or `configFromFiles()`!
Expand All @@ -340,3 +340,20 @@ Configurator::apply()
->withFileReader('.xml', MyCustomXMLFileReader::class)
->configFromFile('config.xml'),
->to($container);
```

### Adding A Custom Container Adapter

You can create your own container adapter so that you can configure other
containers. This is done by implementing the
`TomPHP\ContainerConfigurator\FileReader\ContainerAdapter` interface. Once you
have created your adapter, you can use the
`withContainerAdapter(string $containerName, string $adapterName)` method to
enable the it:

```php
Configurator::apply()
->withContainerAdapter(MyContainer::class, MyContainerAdapter::class)
->configFromArray($appConfig),
->to($container);
```

0 comments on commit 003a244

Please sign in to comment.