-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.php
206 lines (193 loc) · 7.97 KB
/
config.php
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
/**
* Aphiria
*
* @link https://www.aphiria.com
* @copyright Copyright (C) 2024 David Young
* @license https://github.com/aphiria/aphiria.com/blob/master/LICENSE.md
*/
declare(strict_types=1);
use Aphiria\ContentNegotiation\AcceptCharsetEncodingMatcher;
use Aphiria\ContentNegotiation\AcceptLanguageMatcher;
use Aphiria\ContentNegotiation\MediaTypeFormatters\HtmlMediaTypeFormatter;
use Aphiria\ContentNegotiation\MediaTypeFormatters\JsonMediaTypeFormatter;
use Aphiria\ContentNegotiation\MediaTypeFormatters\PlainTextMediaTypeFormatter;
use Aphiria\ContentNegotiation\MediaTypeFormatters\XmlMediaTypeFormatter;
use Aphiria\Framework\Api\Exceptions\ProblemDetailsExceptionRenderer;
use Aphiria\Framework\Serialization\Normalizers\ProblemDetailsNormalizer;
use Aphiria\Validation\ErrorMessages\DefaultErrorMessageTemplateRegistry;
use Aphiria\Validation\ErrorMessages\StringReplaceErrorMessageInterpolator;
use Monolog\Handler\StreamHandler;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
return [
/**
* ----------------------------------------------------------
* Configure Aphiria components
* ----------------------------------------------------------
*
* Note: Removing values here could result in the application not working
*/
'aphiria' => [
/**
* ----------------------------------------------------------
* Configure the API
* ----------------------------------------------------------
*
* localhostRouterPath => The path to the localhost router file
*/
'api' => [
'localhostRouterPath' => __DIR__ . '/localhost_router.php'
],
/**
* ----------------------------------------------------------
* Configure authorization
* ----------------------------------------------------------
*
* continueOnFailure => Whether or not to continue requirement checks on failure
*/
'authorization' => [
'continueOnFailure' => true
],
/**
* ----------------------------------------------------------
* Configure the binders
* ----------------------------------------------------------
*
* metadataCachePath => The path to the binder metadata cache
*/
'binders' => [
'metadataCachePath' => __DIR__ . '/tmp/framework/binderMetadataCollectionCache.txt'
],
/**
* ----------------------------------------------------------
* Configure the console
* ----------------------------------------------------------
*
* attributePaths => The paths to search for command attributes
* commandCachePath => The path to the compiled commands
*/
'console' => [
'attributePaths' => [__DIR__ . '/src'],
'commandCachePath' => __DIR__ . '/tmp/framework/console/commandCache.txt'
],
/**
* ----------------------------------------------------------
* Configure the content negotiator
* ----------------------------------------------------------
*
* encodingMatcher => The matcher for character encodings
* languageMatcher => The matcher for languages
* mediaTypeFormatters => The list of supported media type formatters (first one will be the default)
* supportedLanguages => The list of languages the API supports
*/
'contentNegotiation' => [
'encodingMatcher' => AcceptCharsetEncodingMatcher::class,
'languageMatcher' => AcceptLanguageMatcher::class,
'mediaTypeFormatters' => [
JsonMediaTypeFormatter::class,
XmlMediaTypeFormatter::class,
HtmlMediaTypeFormatter::class,
PlainTextMediaTypeFormatter::class
],
'supportedLanguages' => ['en']
],
/**
* ----------------------------------------------------------
* Configure exception handling
* ----------------------------------------------------------
*
* apiExceptionRenderer => The API exception renderer to use for API applications
*/
'exceptions' => [
'apiExceptionRenderer' => ProblemDetailsExceptionRenderer::class
],
/**
* ----------------------------------------------------------
* Configure the logger
* ----------------------------------------------------------
*
* handlers => The list of handlers to use with logging
* name => The name of the logger
*/
'logging' => [
'handlers' => [
[
'type' => StreamHandler::class,
'path' => 'php://stdout',
'level' => \getenv('LOG_LEVEL')
]
],
'name' => 'app'
],
/**
* ----------------------------------------------------------
* Configure the router
* ----------------------------------------------------------
*
* attributePaths => The paths to search for route attributes
* routeCachePath => The path to the route cache
* trieCachePath => The path to the trie cache
*/
'routing' => [
'attributePaths' => [__DIR__ . '/src'],
'routeCachePath' => __DIR__ . '/tmp/framework/api/routeCache.txt',
'trieCachePath' => __DIR__ . '/tmp/framework/api/trieCache.txt'
],
/**
* ----------------------------------------------------------
* Configure the Symfony serializer
* ----------------------------------------------------------
*
* dateFormat => The format to use for all dates
* encoders => The list of encoders the serializer will use
* nameConverter => The property name converter (can be null)
* normalizers => The list of normalizers the serializer will use
* xml.removeEmptyTags => Whether or not to remove empty XML tags
* xml.rootNodeName => The name of the default XML root node
*/
'serialization' => [
'dateFormat' => DateTime::ATOM,
'encoders' => [
JsonEncoder::class,
XmlEncoder::class
],
'nameConverter' => null,
'normalizers' => [
DateTimeNormalizer::class,
BackedEnumNormalizer::class,
ProblemDetailsNormalizer::class,
ObjectNormalizer::class,
ArrayDenormalizer::class
],
'xml' => [
'removeEmptyTags' => false,
'rootNodeName' => 'response'
]
],
/**
* ----------------------------------------------------------
* Configure the validator
* ----------------------------------------------------------
*
* attributePaths => The paths to search for constraint attributes
* constraintsCachePath => The path to the constraint cache
* errorMessageInterpolator => The error message interpolator to use
* errorMessageTemplates => The error message template registry to use
*/
'validation' => [
'attributePaths' => [__DIR__ . '/src'],
'constraintsCachePath' => __DIR__ . '/tmp/framework/constraintsCache.txt',
'errorMessageInterpolator' => [
'type' => StringReplaceErrorMessageInterpolator::class
],
'errorMessageTemplates' => [
'type' => DefaultErrorMessageTemplateRegistry::class
]
]
]
];