1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Http configuration used across framework, not only in HttpDispatcher. Attention, configs might |
4
|
|
|
* include runtime code which depended on environment values only. |
5
|
|
|
* |
6
|
|
|
* @see HttpConfig |
7
|
|
|
*/ |
8
|
|
|
use Spiral\Http; |
9
|
|
|
use Spiral\Http\Middlewares; |
10
|
|
|
|
11
|
|
|
return [ |
12
|
|
|
/* |
13
|
|
|
* Base application path is required to perform valid routing. |
14
|
|
|
*/ |
15
|
|
|
'basePath' => '/', |
16
|
|
|
|
17
|
|
|
/* |
18
|
|
|
* When set to false http dispatcher will stop reacting on application exception and will |
19
|
|
|
* return only 500 error page. |
20
|
|
|
*/ |
21
|
|
|
'exposeErrors' => env('DEBUG', false), |
22
|
|
|
|
23
|
|
|
/* |
24
|
|
|
* Configuration options for CookieManager middleware. |
25
|
|
|
*/ |
26
|
|
|
'cookies' => [ |
27
|
|
|
//You force specific domain or use pattern like ".{host}" to share cookies with sub domains |
28
|
|
|
'domain' => null, |
29
|
|
|
|
30
|
|
|
//Cookie protection method |
31
|
|
|
'method' => Http\Configs\HttpConfig::COOKIE_ENCRYPT, |
32
|
|
|
|
33
|
|
|
'excluded' => [ |
34
|
|
|
/*{{cookies.excluded}}*/ |
|
|
|
|
35
|
|
|
] |
36
|
|
|
], |
37
|
|
|
|
38
|
|
|
/* |
39
|
|
|
* Configuration options for CSRF middleware. |
40
|
|
|
*/ |
41
|
|
|
'csrf' => [ |
42
|
|
|
'cookie' => 'csrf-token', |
43
|
|
|
'length' => 64, |
44
|
|
|
'lifetime' => null |
45
|
|
|
], |
46
|
|
|
|
47
|
|
|
/* |
48
|
|
|
* Set of headers to be added to every response by default. |
49
|
|
|
*/ |
50
|
|
|
'headers' => [ |
51
|
|
|
'Content-Type' => 'text/html; charset=UTF-8', |
52
|
|
|
'Generator' => 'Spiral', |
53
|
|
|
/*{{headers}}*/ |
54
|
|
|
], |
55
|
|
|
|
56
|
|
|
/* |
57
|
|
|
* You can set your own endpoint class here to change spiral http flow. |
58
|
|
|
*/ |
59
|
|
|
'endpoint' => null, |
60
|
|
|
|
61
|
|
|
/* |
62
|
|
|
* When no endpoints set HttpDispatcher will use constructed router instance. |
63
|
|
|
*/ |
64
|
|
|
'router' => [ |
65
|
|
|
//You can use your own router or entirely replace http endpoint using option above |
66
|
|
|
'class' => Http\Routing\Router::class, |
67
|
|
|
'options' => [] |
68
|
|
|
], |
69
|
|
|
|
70
|
|
|
/* |
71
|
|
|
* This is set of "global" middlewares, they will be applied to every request before endpoint |
72
|
|
|
* executed. |
73
|
|
|
*/ |
74
|
|
|
'middlewares' => [ |
75
|
|
|
Middlewares\ExceptionWrapper::class, |
76
|
|
|
/*{{middlewares}}*/ |
77
|
|
|
], |
78
|
|
|
|
79
|
|
|
/* |
80
|
|
|
* ExceptionIsolator middleware can automatically handle ClientExceptions and populate response |
81
|
|
|
* with corresponding error page. This list must contain array of error codes associated with |
82
|
|
|
* view files. |
83
|
|
|
*/ |
84
|
|
|
'httpErrors' => [ |
85
|
|
|
400 => 'spiral:http/400', |
86
|
|
|
403 => 'spiral:http/403', |
87
|
|
|
404 => 'spiral:http/404', |
88
|
|
|
500 => 'spiral:http/500', |
89
|
|
|
/*{{errors}}*/ |
90
|
|
|
] |
91
|
|
|
]; |
92
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.