Skip to content

Commit 8108bfc

Browse files
authored
[Bref] Add docs about how to invoke handlers from CLI (#76)
* [Bref] Add docs about how to invoke handlers from CLI * style
1 parent 1b96a86 commit 8108bfc

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,27 @@ to serverless.yml
144144
functions:
145145
app:
146146
- handler: public/index.php
147-
+ handler: public/index.php:App\Service\MyHandler
147+
+ handler: public/index.php:App\Lambda\MyLambda
148+
```
149+
150+
#### Invoke handlers locally
151+
152+
Using a service from the container makes the handlers very simple to unit test.
153+
However, if you are lazy, you may want to invoke them locally from CLI.
154+
155+
Run the following command to invoke the `App\Lambda\MyLambda` service.
156+
157+
```cli
158+
./vendor/bin/bref-local-handler.php ./bin/container.php:App\\Lambda\\MyLambda
159+
```
160+
161+
If your service expects some event data, add it as a JSON string or a path to a
162+
file containing JSON.
163+
164+
```cli
165+
./vendor/bin/bref-local-handler.php ./bin/container.php:App\\Lambda\\MyLambda '{"foo":"bar"}'
166+
167+
./vendor/bin/bref-local-handler.php ./bin/container.php:App\\Lambda\\MyLambda example/input.json
148168
```
149169

150170
### Console application

0 commit comments

Comments
 (0)