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
For the persistence in a relational database management system we chose Doctrine ORM (object-relational mapper).
29
+
For the persistence in a relational database management system we chose Doctrine ORM (object-relational mapper).
31
30
32
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.
33
32
@@ -40,15 +39,15 @@ Our documentation is Postman based. We use the following files in which we store
40
39
41
40
## Hypertext Application Language
42
41
43
-
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.
42
+
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.
44
43
45
44
## CORS
46
45
47
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.
48
47
49
-
## OAuth 2
48
+
## OAuth 2.0
50
49
51
-
OAuth 2 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 OAuth2 authentication for Mezzio and PSR-7/PSR-15 applications by using league/oauth2-server package.
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.
52
51
53
52
## Email
54
53
@@ -66,7 +65,7 @@ You can further customize your api within the autoload directory where each conf
66
65
67
66
## Routing
68
67
69
-
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.
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.
70
69
71
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`.
72
71
@@ -76,17 +75,17 @@ For registering new commands first make sure your command class extends `Symfony
76
75
77
76
## File locker
78
77
79
-
Here you will also find our brand-new file locker configuration, so you can easily turn it on or off (by default: `'enabled' => true` )
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`).
80
79
81
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.
82
81
83
82
## PSR Standards
84
83
85
-
* PSR-3: Logger Interface – the application uses `LoggerInterface` for error logging
86
-
* PSR-4: Autoloader – the application locates classes using an autoloader
87
-
* PSR-7: HTTP message interfaces – the handlers return `ResponseInterface`
88
-
* PSR-11: Container interface – the application is container-based
89
-
* PSR-15: HTTP Server Request Handlers – the handlers implement `RequestHandlerInterface`
84
+
*[PSR-3](https://www.php-fig.org/psr/psr-3/): Logger Interface – the application uses `LoggerInterface` for error logging
85
+
*[PSR-4](https://www.php-fig.org/psr/psr-4): Autoloader – the application locates classes using an autoloader
86
+
*[PSR-7](https://www.php-fig.org/psr/psr-7): HTTP message interfaces – the handlers return `ResponseInterface`
87
+
*[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`
Copy file name to clipboardexpand all lines: docs/book/v4/tutorials/create-book-module.md
+30-25
Original file line number
Diff line number
Diff line change
@@ -7,27 +7,27 @@ The below file structure is just an example, you can have multiple components su
7
7
```markdown
8
8
.
9
9
└── src/
10
-
└── Book/
11
-
└── src/
12
-
├── Collection/
13
-
│ └── BookCollection.php
14
-
├── Entity/
15
-
│ └── Book.php
16
-
├── Handler/
17
-
│ └── BookHandler.php
18
-
├── InputFilter/
19
-
│ ├── Input/
20
-
│ │ ├── AuthorInput.php
21
-
│ │ ├── NameInput.php
22
-
│ │ └── ReleaseDateInput.php
23
-
│ └── BookInputFilter.php
24
-
├── Repository/
25
-
│ └── BookRepository.php
26
-
├── Service/
27
-
│ ├── BookService.php
28
-
│ └── BookServiceInterface.php
29
-
├── ConfigProvider.php
30
-
└── RoutesDelegator.php
10
+
└── Book/
11
+
└── src/
12
+
├── Collection/
13
+
│ └── BookCollection.php
14
+
├── Entity/
15
+
│ └── Book.php
16
+
├── Handler/
17
+
│ └── BookHandler.php
18
+
├── InputFilter/
19
+
│ ├── Input/
20
+
│ │ ├── AuthorInput.php
21
+
│ │ ├── NameInput.php
22
+
│ │ └── ReleaseDateInput.php
23
+
│ └── BookInputFilter.php
24
+
├── Repository/
25
+
│ └── BookRepository.php
26
+
├── Service/
27
+
│ ├── BookService.php
28
+
│ └── BookServiceInterface.php
29
+
├── ConfigProvider.php
30
+
└── RoutesDelegator.php
31
31
```
32
32
33
33
*`src/Book/src/Collection/BookCollection.php` - a collection refers to a container for a group of related objects, typically used to manage sets of related entities fetched from a database
@@ -532,9 +532,14 @@ class BookHandler implements RequestHandlerInterface
532
532
533
533
Once you set up all the files as in the example above, you will need to do a few additional configurations:
534
534
535
-
* Register the namespace by adding this line `"Api\\Book\\": "src/Book/src/",` in `composer.json` under the `autoload.psr-4` key.
536
-
* Register the module by adding `Api\Book\ConfigProvider::class,` under `Api\User\ConfigProvider::class,`.
537
-
* Register the module's routes by adding `\Api\Book\RoutesDelegator::class,` under `\Api\User\RoutesDelegator::class,` in `src/App/src/ConfigProvider.php`.
535
+
* register the namespace by adding this line `"Api\\Book\\": "src/Book/src/",` in `composer.json` under the `autoload.psr-4` key
536
+
* register the module by adding `Api\Book\ConfigProvider::class,` under `Api\User\ConfigProvider::class,`
537
+
* register the module's routes by adding `\Api\Book\RoutesDelegator::class,` under `\Api\User\RoutesDelegator::class,` in `src/App/src/ConfigProvider.php`
538
+
* update Composer autoloader by running the command:
539
+
540
+
```shell
541
+
composer dump-autoload
542
+
```
538
543
539
544
It should look like this:
540
545
@@ -641,7 +646,7 @@ curl -X POST http://0.0.0.0:8080/book
0 commit comments