Reputation: 41
I run my laravel app @localhost.
```php artisan serve --host=localhostIP```
On top I run an Andoid app with the same base URL.
Could anyone tell me how can I debug incoming API´s calls like if BASEURL/users is called?
Furthermore, how can I log the happening events in the console
Upvotes: 4
Views: 13179
Reputation: 223
This is my way, but I think it's not good!
Route::post('/check_api', [CheckController::class, 'testFunc'])->name('api.check_api');
Route::post('test/check_api', [CheckController::class, 'testFunc'])->name('test.check_api');
Upvotes: 1
Reputation: 3702
use postman https://www.getpostman.com/downloads/ it's an excellent thing very much usefull
Upvotes: 0
Reputation: 1637
I am developing API's with laravel too, i do it this way:
composer require laravel/homestead
to have it all in a vm 😉 see https://laravel.com/docs/master/homestead for more information, i use the "per project" installation
Download postman
to have the best tool for sending querys to your api and to test your api quick -> https://www.getpostman.com (i use it free)
configure and run your homestead (it's not that complicated).
your homestead is fit with php and xdebug enabled
i am using phpStorm and have my vagrant setup as deployment target
"listen to debug" with phpstorm
to your GET requests, add a queryparam XDEBUG_SESSION_START=PHPSTORM
i can debug my api now 😉
i also wrote https://logcrawler.de to receive the log informations of all my api's and all my server 🤩
I hope, i could help you a little bit
Upvotes: 3
Reputation: 30
You can use logging feature of Laravel. Apply Logs on entry point of application to test whether API url is hitting or not.
Upvotes: 0