Skip to content
This repository was archived by the owner on Jan 17, 2026. It is now read-only.

Commit f0dc143

Browse files
authored
feat: Inject dependencies of UserProvider and UserAccessChecker (#19)
Closes #18 They can have Service dependencies
2 parents dcc23a4 + 6e1579c commit f0dc143

4 files changed

Lines changed: 93 additions & 159 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ interface UserProvider
4141
}
4242
```
4343

44-
The class you pass in the config must implement this interface.
44+
The class you pass in the config must implement this interface. It can have dependencies like a Service, they will be
45+
injected during instantiation.
4546

4647
`User` is an interface also provided by this Brick:
4748

@@ -97,7 +98,8 @@ interface UserAccessChecker
9798
```
9899

99100
This method returns `true` if user is authorized to see resource. It can throw an exception the same way as defined
100-
in [`Archict\router`](https://github.com/Archict/router).
101+
in [`Archict\router`](https://github.com/Archict/router). Implementation of this interface can have some dependencies in
102+
its constructor, they will be injected during instantiation.
101103

102104
Then you can provide the class name to your rule with the tag `checker`:
103105

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"phpunit/phpunit": "^10",
2626
"squizlabs/php_codesniffer": "^3.9",
2727
"slevomat/coding-standard": "^8.15",
28-
"archict/core": "^0",
28+
"archict/core": "^0.3",
2929
"guzzlehttp/psr7": "^2.6"
3030
},
3131
"scripts": {

0 commit comments

Comments
 (0)