You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/book/v5/introduction/introduction.md
+39-20Lines changed: 39 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Introduction
2
2
3
-
Based on Enrico Zimuel’s Zend Expressive API – Skeleton example, DotKernel API runs on Laminas and Mezzio components and implements standards like PSR-3, PSR-4, PSR-7, PSR-11 and PSR-15.
3
+
Based on Enrico Zimuel’s Zend Expressive API – Skeleton example, DotKernel API runs on Laminas and Mezzio components and
4
+
implements standards like PSR-3, PSR-4, PSR-7, PSR-11 and PSR-15.
4
5
5
6
Here is a list of the core components:
6
7
@@ -13,9 +14,9 @@ Here is a list of the core components:
@@ -24,72 +25,90 @@ Here is a list of the core components:
24
25
* Fixtures (dotkernel/dot-data-fixtures)
25
26
* UUID (ramsey/uuid-doctrine)
26
27
27
-
## Doctrine 2 ORM
28
+
## Doctrine 3 ORM
28
29
29
30
For the persistence in a relational database management system we chose Doctrine ORM (object-relational mapper).
30
31
31
-
The benefit of Doctrine for the programmer is the ability to focus on the object-oriented business logic and worry about persistence only as a secondary priority.
32
+
The benefit of Doctrine for the programmer is the ability to focus on the object-oriented business logic and worry about
33
+
persistence only as a secondary priority.
32
34
33
35
## Documentation
34
36
35
-
Our documentation is Postman based. We use the following files in which we store information about every available endpoint ready to be tested:
37
+
Our documentation is Postman based. We use the following files in which we store information about every available
For our API payloads (a value object for describing the API resource, its relational links and any embedded/child resources related to it) we chose mezzio-hal.
45
+
For our API payloads (a value object for describing the API resource, its relational links and any embedded/child
46
+
resources related to it) we chose mezzio-hal.
43
47
44
48
## CORS
45
49
46
-
By using `MezzioCorsMiddlewareCorsMiddleware`, the CORS preflight will be recognized and the middleware will start to detect the proper CORS configuration. The Router is used to detect every allowed request method by executing a route match with all possible request methods. Therefore, for every preflight request, there is at least one Router request.
50
+
By using `MezzioCorsMiddlewareCorsMiddleware`, the CORS preflight will be recognized and the middleware will start to
51
+
detect the proper CORS configuration. The Router is used to detect every allowed request method by executing a route
52
+
match with all possible request methods. Therefore, for every preflight request, there is at least one Router request.
47
53
48
54
## OAuth 2.0
49
55
50
-
OAuth 2.0 is an authorization framework that enables applications to obtain limited access to user accounts on your DotKernel API. We are using mezzio/mezzio-authentication-oauth2 which provides OAuth 2.0 authentication for Mezzio and PSR-7/PSR-15 applications by using league/oauth2-server package.
56
+
OAuth 2.0 is an authorization framework that enables applications to obtain limited access to user accounts on your
57
+
DotKernel API. We are using mezzio/mezzio-authentication-oauth2 which provides OAuth 2.0 authentication for Mezzio and
58
+
PSR-7/PSR-15 applications by using league/oauth2-server package.
51
59
52
60
## Email
53
61
54
-
It is not unlikely for an API to send emails depending on the use case. Here is another area where DotKernel API shines. Using `DotMailServiceMailService` provided by dotkernel/dot-mail you can easily send custom email templates.
62
+
It is not unlikely for an API to send emails depending on the use case. Here is another area where DotKernel API shines.
63
+
Using `DotMailServiceMailService` provided by dotkernel/dot-mail you can easily send custom email templates.
55
64
56
65
## Configuration
57
66
58
-
From authorization at request route level to API keys for your application, you can find every configuration variable in the config directory.
67
+
From authorization at request route level to API keys for your application, you can find every configuration variable in
68
+
the config directory.
59
69
60
70
Registering a new module can be done by including its ConfigProvider.php in config.php.
61
71
62
-
Brand new middlewares should go into pipeline.php. Here you can edit the order in which they run and find more info about the currently included ones.
72
+
Brand new middlewares should go into pipeline.php. Here you can edit the order in which they run and find more info
73
+
about the currently included ones.
63
74
64
75
You can further customize your api within the autoload directory where each configuration category has its own file.
65
76
66
77
## Routing
67
78
68
-
Each module has a `RoutesDelegator.php` file for managing existing routes inside that specific module. It also allows a quick way of adding new routes by providing the route path, Middlewares that the route will use and the route name.
79
+
Each module has a `RoutesDelegator.php` file for managing existing routes inside that specific module. It also allows a
80
+
quick way of adding new routes by providing the route path, Middlewares that the route will use and the route name.
69
81
70
-
You can allocate permissions per route name in order to restrict access for a user role to a specific route in `config/autoload/authorization.global.php`.
82
+
You can allocate permissions per route name in order to restrict access for a user role to a specific route
83
+
in `config/autoload/authorization.global.php`.
71
84
72
85
## Commands
73
86
74
-
For registering new commands first make sure your command class extends `SymfonyComponentConsoleCommandCommand`. Then you can enable it by registering it in `config/autoload/cli.global.php`.
87
+
For registering new commands first make sure your command class extends `Symfony\Component\Console\Command\Command`.
88
+
Then you can enable it by registering it in `config/autoload/cli.global.php`.
75
89
76
90
## File locker
77
91
78
-
Here you will also find our brand-new file locker configuration, so you can easily turn it on or off (by default: `'enabled' => true`).
92
+
Here you will also find our brand-new file locker configuration, so you can easily turn it on or off (by
93
+
default: `'enabled' => true`).
79
94
80
-
Note: The File Locker System will create a `command-{command-default-name}.lock` file which will not let another instance of the same command to run until the previous one has finished.
95
+
Note: The File Locker System will create a `command-{command-default-name}.lock` file which will not let another
96
+
instance of the same command to run until the previous one has finished.
81
97
82
98
## PSR Standards
83
99
84
-
*[PSR-3](https://www.php-fig.org/psr/psr-3/): Logger Interface – the application uses `LoggerInterface` for error logging
100
+
*[PSR-3](https://www.php-fig.org/psr/psr-3/): Logger Interface – the application uses `LoggerInterface` for error
101
+
logging
85
102
*[PSR-4](https://www.php-fig.org/psr/psr-4): Autoloader – the application locates classes using an autoloader
86
103
*[PSR-7](https://www.php-fig.org/psr/psr-7): HTTP message interfaces – the handlers return `ResponseInterface`
87
104
*[PSR-11](https://www.php-fig.org/psr/psr-11): Container interface – the application is container-based
88
-
*[PSR-15](https://www.php-fig.org/psr/psr-15): HTTP Server Request Handlers – the handlers implement `RequestHandlerInterface`
105
+
*[PSR-15](https://www.php-fig.org/psr/psr-15): HTTP Server Request Handlers – the handlers
106
+
implement `RequestHandlerInterface`
89
107
90
108
## Tests
91
109
92
-
One of the best ways to ensure the quality of your product is to create and run functional and unit tests. You can find factory-made tests in the tests/AppTest/ folder, and you can also register your own.
110
+
One of the best ways to ensure the quality of your product is to create and run functional and unit tests. You can find
111
+
factory-made tests in the `tests/AppTest/` folder, and you can also register your own.
93
112
94
113
We have 2 types of tests: functional and unit tests, you can run both types at the same type by executing this command:
0 commit comments