Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ The configuration file can then include an `import` section:
imports:
- { resource: 'config.*.yml', type: glob }
- { resource: 'env.yml' }
- { resource: \MyNamespace\MyConfigReader, type: class, option: 'My option' }
```

## Feedback
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "1.0.x-dev"
"dev-main": "0.12.x-dev"
}
}
}
9 changes: 9 additions & 0 deletions src/ConfigurationReaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ public function __construct(string $resourceBasePath = null)
private function registerDefaultReaderTypes()
{
$this->readerTypes = [
'class' => [
'factory' => function (string $resource, array $options) {
if (!class_exists($resource)) {
throw new InvalidArgumentException(sprintf('Invalid reader class provided "%s". Must be a class implementing ConfigReaderInterface', $resource), 1654212558);
}
return new $resource($this, $options);
},
'isFileResource' => false,
],
'env' => [
'factory' => function (string $resource) {
return new EnvironmentReader($resource);
Expand Down