Simple example of an API REST with Symfony 5
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install or composer install
$ cp .env.dist .env
$ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:8000/api/books
$ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:8000/api/books/:id
$ curl -H 'content-type: application/json' -v -X POST -d '{"title":"Foo bar","price":"19.99"}' http://127.0.0.1:8000/api/book/new
$ curl -H 'content-type: application/json' -v -X PUT -d '{"title":"Foo bar","price":"19.99"}' http://127.0.0.1:8000/api/books/edit/:id
$ curl -H 'content-type: application/json' -v -X DELETE http://127.0.0.1:8000/api/books/remove/:id
$ curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:8000/api/books -H 'Authorization:Basic username:password or email:password'
$ phpunit or ./bin/phpunit