Improve config folder structure and add caching - #708
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR centralizes and optimizes configuration loading by introducing caching, removing legacy default layers, and standardizing how defaults are accessed in controllers.
- Adds a host-scoped cache layer in
ConfigServiceLoaderto speed up repeated bootstraps. - Removes the old “defaults” mechanism from
Config, consolidating onto a single config array and throwing on load errors. - Refactors panel/site controllers to use a new
defaultConfig()helper instead of removeddefaults()methods and updates routing/methods paths.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| formwork/src/Services/Loaders/ConfigServiceLoader.php | Implements file-based caching for resolved configs, per host |
| formwork/src/Panel/Controllers/OptionsController.php | Replaces app->defaults()/site->defaults() with defaultConfig() |
| formwork/src/Config/Exceptions/ConfigLoadingException.php | Introduces exception for missing/unsupported config files |
| formwork/src/Config/Config.php | Drops separate defaults storage, adds load-file error handling |
| formwork/src/Cms/Site.php | Removes legacy defaults merge, renames alias loader to setRouteAliases |
| formwork/src/Cms/App.php | Adjusts DI definitions order and view-methods path resolution |
| formwork/config/system.yaml | Updates routes and views.methods file paths |
Comments suppressed due to low confidence (1)
formwork/src/Cms/Site.php:459
- You renamed
loadRouteAliases()tosetRouteAliases(array $aliases), but removed its invocation inload(). To restore route aliases setup, call$this->setRouteAliases($this->data['routeAliases'])(e.g. right after populating$this->data).
$this->fields->setModel($this);
giuscris
force-pushed
the
update-config-structure
branch
from
June 14, 2025 19:44
87e77c2 to
f82ea6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.