You’re browsing the documentation for v3.x.

  Click here  for earlier leaf api versions.

# App Config

App config allows you to directly configure how Leaf generally behaves.

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Place app in maintainance mode
    |--------------------------------------------------------------------------
    |
    | Replacement for earlier mode=down. You can set this to true to place
    | your app in a maintainance like state. It will display Leaf's default
    | app down page if a custom handler is not set.
    |
    | See:
    | https://leafphp.netlify.app/#/leaf/v/2.5.0/config/settings?id=appdown-new
    |
    */
    'app.down' => false,

    /*
    |--------------------------------------------------------------------------
    | App debugging
    |--------------------------------------------------------------------------
    |
    | If debugging is enabled, Leaf will use its built-in error handler to
    | display diagnostic information for uncaught Exceptions, else it will
    | display a bare error page usable in production. You can set a
    | custom error page to display using `$app->setError`.
    |
    | You might want to turn this off in production.
    |
    */
    'debug' => true,

    /*
    |--------------------------------------------------------------------------
    | HTTP Version
    |--------------------------------------------------------------------------
    |
    | By default, Leaf returns an HTTP/1.1 response to the client.
    | Use this setting if you need to return an HTTP/1.0 response.
    |
    */
    'http.version' => '1.1',

    /*
    |--------------------------------------------------------------------------
    | Log directory
    |--------------------------------------------------------------------------
    |
    | This tells leaf which directory to save and look for logs.
    |
    */
    'log.dir' => 'storage/logs/',

    /*
    |--------------------------------------------------------------------------
    | Log Enabled
    |--------------------------------------------------------------------------
    |
    | This enables or disables Leaf’s logger. Note that if log.enabled is
    | set to false. Leaf will skip initializing anything related to logs,
    | as such, you won't have access to $app->logger(),
    | $app->log or $app->logWriter.
    |
    */
    'log.enabled' => true,

    /*
    |--------------------------------------------------------------------------
    | Log file
    |--------------------------------------------------------------------------
    |
    | This setting tells leaf which file to write logs to.
    |
    */
    'log.file' => 'app.log',

    /*
    |--------------------------------------------------------------------------
    | Log level
    |--------------------------------------------------------------------------
    |
    | Leaf has these log levels:
    |
    | - \Leaf\Log::EMERGENCY
    | - \Leaf\Log::ALERT
    | - \Leaf\Log::CRITICAL
    | - \Leaf\Log::ERROR
    | - \Leaf\Log::WARN
    | - \Leaf\Log::NOTICE
    | - \Leaf\Log::INFO
    | - \Leaf\Log::DEBUG
    |
    */
    'log.level' => \Leaf\Log::DEBUG,

    /*
    |--------------------------------------------------------------------------
    | Log open
    |--------------------------------------------------------------------------
    |
    | Takes in a boolean and determines whether Leaf should create
    | the specified log file if it doesn't exist.
    |
    */
    'log.open' => true,

    /*
    |--------------------------------------------------------------------------
    | Log writer
    |--------------------------------------------------------------------------
    |
    | Use a custom log writer to direct logged messages
    | to the appropriate output destination.
    |
    */
    'log.writer' => null,

    /*
    |--------------------------------------------------------------------------
    | Mode
    |--------------------------------------------------------------------------
    |
    | This is an identifier for the application’s current mode of operation.
    | The mode does not affect a Leaf application’s internal functionality.
    |
    */
    'mode' => 'development',

    /*
    |--------------------------------------------------------------------------
    | Views path
    |--------------------------------------------------------------------------
    |
    | The relative or absolute path to the filesystem directory that
    | contains your Leaf application’s view files.
    |
    */
    'views.path' => ViewsPath(null, false),

    /*
    |--------------------------------------------------------------------------
    | views cache path
    |--------------------------------------------------------------------------
    |
    | This config tells leaf where to save cached and compiled views.
    |
    */
    'views.cachePath' => StoragePath('framework/views')
];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150