Symfony 5 + FOSRestBundle + JSON Standard responses + working example
Symfony 5 skeleton to build REST APIs, inclusive of:
- FOSRestBundle (friendsofsymfony/rest-bundle) to simplify the entire process
- Hateoas Bundle (willdurand/hateoas-bundle) that specifies relation types for Web links
- Doctrine
This project is compliant with:
- Symfony Best Practices
- HATEOAS, RFC5988 (web links), JSON HAL Model
- URIs versioning
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
What things you need to install the software and how to install them.
git clone https://github.com/demartis/symfony5-rest-api/
cd symfony5-rest-api
cp .env.dist .env
## edit .env if needed
composer install
symfony server:start
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate
curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:8000/v1/books
curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:8000/v1/books/2
Add notes about how to use the system.
- Fork it (https://github.com/demartis/symfony5-rest-api/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request