Skip to content

Commit

Permalink
Update config doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Jul 9, 2021
1 parent 6d98afe commit 73c2573
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@

## Gacela Framework

This framework helps you to improve the design of your modules.
Gacela is a class resolver. It helps you to improve the design of your modules.

> Inspired by Spryker Framework: https://github.com/spryker
Splitting your project into different modules will help the design of your project in terms of maintainability and
scalability. It will certainly encourage your modules to interact with each other in a unified way by following these
rules:

- Different modules can interact **ONLY** via their `Facade`
- The `Facade` has access to the `Factory`
- The `Factory` creates the objects from the module and has access to the Module's `Config`
- The `Config` gets the values from your defined config files
- The `DependencyProvider` uses the Locator to get the Facades from different modules
- Different modules can interact **only** via their `Facade`.
- The `Facade` has access to the `Factory`.
- The `Factory` creates the objects from the module and has access to the Module's `Config`.
- The `Config` gets the values from your defined config files.
- The `DependencyProvider` uses the Locator to get the Facades from different modules.

### Installation

Expand Down
42 changes: 36 additions & 6 deletions docs/004_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,36 @@ Using `.env` config files:
"config": {
"type": "env",
"path": ".env*",
"path_local": ".env.local.dist"
"path_local": ".env.local"
}
}
```

- `type`: enum with possible values `php` or `env`
- `path`: this is the path of the folder which contains your application configuration.
You can use `?` or `*` in order to match 1 or multiple characters. Check [`glob()`](https://www.php.net/manual/en/function.glob.php) function for more info.
- `path_local`: this is the last file loaded, which means, it will override the previous configuration,
so you can easily add it to your `.gitignore` and set your local config values in case you want to have something different for some cases
Or even multiple types of config files:

```json
{
"config": [
{
"type": "php",
"path": "config/*.php",
"path_local": "config/local.php"
},
{
"type": "env",
"path": ".env*",
"path_local": ".env.local"
}
]
}
```

- `"type"`: possible values `php` or `env`
- `"path"`: the path of the folder which contains your application configuration.
You can use `?` or `*` in order to match 1 or multiple characters.
Check [`glob()`](https://www.php.net/manual/en/function.glob.php) function for more info.
- `"path_local"`: this is the last file loaded, which means, it will override the previous configuration,
so you can add it to your `.gitignore` and set your own local config values.
---

> This is tightly coupled with the infrastructure layer, because there is I/O involved.
Expand All @@ -48,6 +67,17 @@ Using `.env` config files:
### An example

```json
# gacela.json
{
"config": {
"type": "php",
"path": "config/*.php",
"path_local": "config/local.php"
}
}
```

```php
# config/default.php
use src\Calculator\Config;
Expand Down

0 comments on commit 73c2573

Please sign in to comment.