Skip to content

Commit 5f84a3a

Browse files
committed
fix conflicts
2 parents 32cc063 + 9d94d4b commit 5f84a3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+10796
-6799
lines changed

artisan.md

Lines changed: 149 additions & 109 deletions
Large diffs are not rendered by default.

authentication.md

Lines changed: 150 additions & 159 deletions
Large diffs are not rendered by default.

authorization.md

Lines changed: 245 additions & 134 deletions
Large diffs are not rendered by default.

billing.md

Lines changed: 372 additions & 276 deletions
Large diffs are not rendered by default.

blade.md

Lines changed: 448 additions & 288 deletions
Large diffs are not rendered by default.

broadcasting.md

Lines changed: 265 additions & 168 deletions
Large diffs are not rendered by default.

cache.md

Lines changed: 57 additions & 43 deletions
Large diffs are not rendered by default.

cashier-paddle.md

Lines changed: 324 additions & 196 deletions
Large diffs are not rendered by default.

collections.md

Lines changed: 277 additions & 134 deletions
Large diffs are not rendered by default.

configuration.md

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,40 @@
55
- [Environment Variable Types](#environment-variable-types)
66
- [Retrieving Environment Configuration](#retrieving-environment-configuration)
77
- [Determining The Current Environment](#determining-the-current-environment)
8-
- [Hiding Environment Variables From Debug Pages](#hiding-environment-variables-from-debug)
98
- [Accessing Configuration Values](#accessing-configuration-values)
109
- [Configuration Caching](#configuration-caching)
10+
- [Debug Mode](#debug-mode)
1111
- [Maintenance Mode](#maintenance-mode)
1212

1313
<a name="introduction"></a>
1414
## Introduction
1515

1616
All of the configuration files for the Laravel framework are stored in the `config` directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.
1717

18+
These configuration files allow you to configure things like your database connection information, your mail server information, as well as various other core configuration values such as your application timezone and encryption key.
19+
1820
<a name="environment-configuration"></a>
1921
## Environment Configuration
2022

2123
It is often helpful to have different configuration values based on the environment where the application is running. For example, you may wish to use a different cache driver locally than you do on your production server.
2224

23-
To make this a cinch, Laravel utilizes the [DotEnv](https://github.com/vlucas/phpdotenv) PHP library by Vance Lucas. In a fresh Laravel installation, the root directory of your application will contain a `.env.example` file. If you install Laravel via Composer, this file will automatically be copied to `.env`. Otherwise, you should copy the file manually.
25+
To make this a cinch, Laravel utilizes the [DotEnv](https://github.com/vlucas/phpdotenv) PHP library. In a fresh Laravel installation, the root directory of your application will contain a `.env.example` file that defines many common environment variables. During the Laravel installation process, this file will automatically be copied to `.env`.
2426

25-
Your `.env` file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration. Furthermore, this would be a security risk in the event an intruder gains access to your source control repository, since any sensitive credentials would get exposed.
27+
Laravel's default `.env` file contains some common configuration values that may differ based on whether your application is running locally or on a production web server. These values are then retrieved from various Laravel configuration files within the `config` directory using Laravel's `env` function.
2628

27-
If you are developing with a team, you may wish to continue including a `.env.example` file with your application. By putting placeholder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application. You may also create a `.env.testing` file. This file will override the `.env` file when running PHPUnit tests or executing Artisan commands with the `--env=testing` option.
29+
If you are developing with a team, you may wish to continue including a `.env.example` file with your application. By putting placeholder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application.
2830

2931
> {tip} Any variable in your `.env` file can be overridden by external environment variables such as server-level or system-level environment variables.
3032
33+
<a name="environment-file-security"></a>
34+
#### Environment File Security
35+
36+
Your `.env` file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration. Furthermore, this would be a security risk in the event an intruder gains access to your source control repository, since any sensitive credentials would get exposed.
37+
3138
<a name="environment-variable-types"></a>
3239
### Environment Variable Types
3340

34-
All variables in your `.env` files are parsed as strings, so some reserved values have been created to allow you to return a wider range of types from the `env()` function:
41+
All variables in your `.env` files are typically parsed as strings, so some reserved values have been created to allow you to return a wider range of types from the `env()` function:
3542

3643
`.env` Value | `env()` Value
3744
------------- | -------------
@@ -44,27 +51,29 @@ empty | (string) ''
4451
null | (null) null
4552
(null) | (null) null
4653

47-
If you need to define an environment variable with a value that contains spaces, you may do so by enclosing the value in double quotes.
54+
If you need to define an environment variable with a value that contains spaces, you may do so by enclosing the value in double quotes:
4855

4956
APP_NAME="My Application"
5057

5158
<a name="retrieving-environment-configuration"></a>
5259
### Retrieving Environment Configuration
5360

54-
All of the variables listed in this file will be loaded into the `$_ENV` PHP super-global when your application receives a request. However, you may use the `env` helper to retrieve values from these variables in your configuration files. In fact, if you review the Laravel configuration files, you will notice several of the options already using this helper:
61+
All of the variables listed in this file will be loaded into the `$_ENV` PHP super-global when your application receives a request. However, you may use the `env` helper to retrieve values from these variables in your configuration files. In fact, if you review the Laravel configuration files, you will notice many of the options are already using this helper:
5562

5663
'debug' => env('APP_DEBUG', false),
5764

58-
The second value passed to the `env` function is the "default value". This value will be used if no environment variable exists for the given key.
65+
The second value passed to the `env` function is the "default value". This value will be returned if no environment variable exists for the given key.
5966

6067
<a name="determining-the-current-environment"></a>
6168
### Determining The Current Environment
6269

6370
The current application environment is determined via the `APP_ENV` variable from your `.env` file. You may access this value via the `environment` method on the `App` [facade](/docs/{{version}}/facades):
6471

72+
use Illuminate\Support\Facades\App;
73+
6574
$environment = App::environment();
6675

67-
You may also pass arguments to the `environment` method to check if the environment matches a given value. The method will return `true` if the environment matches any of the given values:
76+
You may also pass arguments to the `environment` method to determine if the environment matches a given value. The method will return `true` if the environment matches any of the given values:
6877

6978
if (App::environment('local')) {
7079
// The environment is local
@@ -74,35 +83,7 @@ You may also pass arguments to the `environment` method to check if the environm
7483
// The environment is either local OR staging...
7584
}
7685

77-
> {tip} The current application environment detection can be overridden by a server-level `APP_ENV` environment variable. This can be useful when you need to share the same application for different environment configurations, so you can set up a given host to match a given environment in your server's configurations.
78-
79-
<a name="hiding-environment-variables-from-debug"></a>
80-
### Hiding Environment Variables From Debug Pages
81-
82-
When an exception is uncaught and the `APP_DEBUG` environment variable is `true`, the debug page will show all environment variables and their contents. In some cases you may want to obscure certain variables. You may do this by updating the `debug_hide` option in your `config/app.php` configuration file.
83-
84-
Some variables are available in both the environment variables and the server / request data. Therefore, you may need to hide them for both `$_ENV` and `$_SERVER`:
85-
86-
return [
87-
88-
// ...
89-
90-
'debug_hide' => [
91-
'_ENV' => [
92-
'APP_KEY',
93-
'DB_PASSWORD',
94-
],
95-
96-
'_SERVER' => [
97-
'APP_KEY',
98-
'DB_PASSWORD',
99-
],
100-
101-
'_POST' => [
102-
'password',
103-
],
104-
],
105-
];
86+
> {tip} The current application environment detection can be overridden by defining a server-level `APP_ENV` environment variable.
10687
10788
<a name="accessing-configuration-values"></a>
10889
## Accessing Configuration Values
@@ -121,12 +102,19 @@ To set configuration values at runtime, pass an array to the `config` helper:
121102
<a name="configuration-caching"></a>
122103
## Configuration Caching
123104

124-
To give your application a speed boost, you should cache all of your configuration files into a single file using the `config:cache` Artisan command. This will combine all of the configuration options for your application into a single file which will be loaded quickly by the framework.
105+
To give your application a speed boost, you should cache all of your configuration files into a single file using the `config:cache` Artisan command. This will combine all of the configuration options for your application into a single file which can be quickly loaded by the framework.
125106

126-
You should typically run the `php artisan config:cache` command as part of your production deployment routine. The command should not be run during local development as configuration options will frequently need to be changed during the course of your application's development.
107+
You should typically run the `php artisan config:cache` command as part of your production deployment process. The command should not be run during local development as configuration options will frequently need to be changed during the course of your application's development.
127108

128109
> {note} If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded and all calls to the `env` function will return `null`.
129110
111+
<a name="debug-mode"></a>
112+
## Debug Mode
113+
114+
The `debug` option in your `config/app.php` configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your `.env` file.
115+
116+
For local development, you should set the `APP_DEBUG` environment variable to `true`. **In your production environment, this value should always be `false`. If the variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.**
117+
130118
<a name="maintenance-mode"></a>
131119
## Maintenance Mode
132120

@@ -186,4 +174,4 @@ While your application is in maintenance mode, no [queued jobs](/docs/{{version}
186174
<a name="alternatives-to-maintenance-mode"></a>
187175
#### Alternatives To Maintenance Mode
188176

189-
Since maintenance mode requires your application to have several seconds of downtime, consider alternatives like [Envoyer](https://envoyer.io) to accomplish zero-downtime deployment with Laravel.
177+
Since maintenance mode requires your application to have several seconds of downtime, consider alternatives like [Laravel Vapor](https://vapor.laravel.com) and [Envoyer](https://envoyer.io) to accomplish zero-downtime deployment with Laravel.

0 commit comments

Comments
 (0)