1
1
# Quick Start
2
2
3
- ## Installation
4
-
5
- To install this package in your application, use
6
- [ Composer] ( https://getcomposer.org ) :
7
-
8
- ``` bash
9
- $ composer require mezzio/mezzio-problem-details
10
- ```
11
-
12
- ## Usage
13
-
14
3
This package provides three primary mechanisms for creating and returning
15
4
Problem Details responses:
16
5
@@ -23,7 +12,7 @@ Problem Details responses:
23
12
exceptions as problem details responses using the
24
13
` ProblemDetailsResponseFactory ` .
25
14
26
- ### ProblemDetailsResponseFactory
15
+ ## ProblemDetailsResponseFactory
27
16
28
17
If you are using [ Mezzio] ( https://docs.mezzio.dev/mezzio/ )
29
18
and have installed [ laminas-component-installer] ( https://docs.laminas.dev/laminas-component-installer )
@@ -148,7 +137,7 @@ The above modifies the original example to add validation and, on failed
148
137
validation, return a custom response that includes the validation failure
149
138
messages.
150
139
151
- ### Custom Exceptions
140
+ ## Custom Exceptions
152
141
153
142
In the above examples, we have a ` DomainException ` that is used to create a
154
143
Problem Details response. By default, in production mode, the factory will use
@@ -236,7 +225,7 @@ class DomainException extends PhpDomainException implements ProblemDetailsExcept
236
225
The data present in the generated exception will then be used by the
237
226
` ProblemDetailsResponseFactory ` to generate full Problem Details.
238
227
239
- ### Error handling
228
+ ## Error handling
240
229
241
230
When writing APIs, you may not want to handle every error or exception manually,
242
231
or may not be aware of problems in your code that might lead to them. In such
@@ -281,7 +270,7 @@ $app->post('/api/domain/transaction', [
281
270
]);
282
271
```
283
272
284
- ### Not Found handling
273
+ ## Not Found handling
285
274
286
275
When writing APIs you may also want 404 responses be in the accepted content-type.
287
276
This package provides ` ProblemDetailsNotFoundHandler ` which will return a
0 commit comments