Skip to content

Commit 2ceb721

Browse files
committed
feat: Enhance framework integration examples in documentation
1 parent a05cf94 commit 2ceb721

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ echo $user->email; // john@example.com
9999
// Method argument resolution from $_POST
100100
$method = new ReflectionMethod(UserController::class, 'register');
101101
$args = $inputQuery->getArguments($method, $_POST);
102-
$controller->register(...$args);
102+
$result = $method->invokeArgs($controller, $args);
103103

104104
// Or with PSR-7 Request
105105
$args = $inputQuery->getArguments($method, $request->getParsedBody());
106-
$controller->register(...$args);
106+
$result = $method->invokeArgs($controller, $args);
107107
```
108108

109109
### Nested Objects
@@ -195,8 +195,8 @@ $data = [
195195
]
196196
];
197197

198-
$args = $inputQuery->getArguments($method, $data);
199-
// $args[0] will be an array of UserInput objects
198+
$result = $method->invokeArgs($controller, $inputQuery->getArguments($method, $data));
199+
// Arguments automatically resolved as UserInput objects
200200
```
201201

202202
#### Simple array values (e.g., checkboxes)

docs/framework-comparison.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public function updateProfile()
3838
throw new Exception('Invalid email');
3939
}
4040
}
41+
42+
// Framework integration
43+
$result = $controller->updateProfile();
4144
```
4245

4346
## Laravel
@@ -70,6 +73,11 @@ public function updateProfile(UpdateProfileRequest $request)
7073
$avatarPath = $avatar->store('avatars');
7174
}
7275
}
76+
77+
// Framework integration
78+
$request = UpdateProfileRequest::createFromGlobals();
79+
$request->validate();
80+
$result = $controller->updateProfile($request);
7381
```
7482

7583
## Symfony
@@ -103,6 +111,12 @@ public function updateProfile(Request $request)
103111
$avatar = $form->get('avatar')->getData(); // String field names - no IDE support
104112
}
105113
}
114+
115+
// Framework integration
116+
$form = $this->createForm(ProfileType::class);
117+
$form->handleRequest($request);
118+
$data = $form->getData();
119+
$result = $controller->updateProfile($data);
106120
```
107121

108122
## Ray.InputQuery
@@ -125,7 +139,7 @@ public function updateProfile(
125139
$inputQuery = new InputQuery(new Injector());
126140
$method = new ReflectionMethod($controller, 'updateProfile');
127141
$args = $inputQuery->getArguments($method, $_POST);
128-
$result = $controller->updateProfile(...$args);
142+
$result = $method->invokeArgs($controller, $args);
129143
```
130144

131145
## Key Differences

0 commit comments

Comments
 (0)