We want to implement a basic api controller and a client to test it.
create a controller in your bundle.
Save it to AppBundle/controllers/Api/UserController.php
edit you routing under app/config/routing.yml and add the app_api part
At that point the api controller is available unter "localhost:8000/api/user"
But we wan to write a short testfile, to test our api with gusszle.
add guzzle to your composer
composer
cmd->require eightpoints/guzzle-bundle
This loads guzzle.
Create a file named test.php in your project root
open a terminal an hit the file:
php test.php
You will get your controller response directly.
Keine Kommentare:
Kommentar veröffentlichen