You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/mvc/index.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,7 @@ For a fresh MVC app, the directory structure looks like this:
76
76
│ ├── routes
77
77
│ └── views
78
78
│ └── errors
79
+
├───config
79
80
├───public
80
81
│ └───assets
81
82
│ ├── css
@@ -127,9 +128,9 @@ For a fresh MVC app, the directory structure looks like this:
127
128
128
129
-### The `config` directory
129
130
130
-
The `config` directory contains the configuration files for your application. v3.8 and above do not come with a `config` directory out of the box, but you can publish the default configuration files using the [`config:publish` command](#configuring-leaf-mvc).
131
+
The `config` directory contains the configuration files for your application. The configuration files are used to configure how Leaf and it's modules interact with your application. Each file controls a different feature of your application, e.g. the `app.php` file is used to configure the application, the `database.php` file is used to configure the database connection, etc.
131
132
132
-
The configuration files are used to configure how Leaf and it's modules interact with your application. Each file controls a different feature of your application, e.g. the `app.php` file is used to configure the application, the `database.php` file is used to configure the database connection, etc.
133
+
Leaf MVC now allows you to completely remove this directory if you are only going to use the default configuration values which will make your application lighter. Leaf v3.8 and above allow you to publish the default configuration files using the [`config:publish` command](#configuring-leaf-mvc) if you end up deleting the `config` directory and want it back.
133
134
134
135
-### The `public` directory
135
136
@@ -145,21 +146,23 @@ For a fresh MVC app, the directory structure looks like this:
145
146
-`framework` - Contains the framework generated files for your application.
146
147
-`logs` - Contains the log files generated by your application.
147
148
149
+
This directory is not created by default in Leaf v3.8 and above. It will be automatically created when you run the `leaf serve` command, logging, storage link or any other command/module that requires it.
150
+
148
151
-### The `vendor` directory
149
152
150
153
The `vendor` directory contains all the dependencies installed by Composer. It's automatically generated when you install the dependencies using Composer.
151
154
152
155
## Configuring Leaf MVC
153
156
154
-
Leaf MVC tries to maintain a clean and easy-to-understand structure that works out-of-the-box for most applications, which means that for most applications, you only need to change a few details in your .env file. For this reason, we don't ship with a `config` directory by default.
157
+
Leaf MVC tries to maintain a clean and easy-to-understand structure that works out-of-the-box for most applications, which means that for most applications, you only need to change a few details in your .env file. For this reason, we allow you to completely remove the `config` directory if you are only going to use the default configuration values. This will make your application lighter and easier to maintain.
155
158
156
159
There are however some times when you need to customize some features to fit your specific use-cases, and that's where the configuration files come in. Leaf MVC separates the configuration files for each feature of the framework, so you can easily customize one feature without affecting the others. To publish all the default configuration files, you can run the following command:
157
160
158
161
```bash:no-line-numbers
159
162
php leaf config:publish
160
163
```
161
164
162
-
This will create a config directory in your application root and copy all the default configuration files to this directory just as we had in previous versions. You can then go ahead to customize the configuration files to fit your specific use-cases.
165
+
This will re-create a config directory in your application root and copy all the default configuration files to this directory just as we had in previous versions. You can then go ahead to customize the configuration files to fit your specific use-cases.
163
166
164
167
Since Leaf MVC has defaults set for most of the configuration options, you don't need to change all the values in the configuration files, you only need to change only the specific values you want to customize so you can leave the rest of the configuration as it is. Each option is documented, so feel free to look through the files and get familiar with the options available to you.
0 commit comments