user3130641
user3130641

Reputation: 17

What is the best way to handle Json api request in symfony 2.7/2.8

what is the best way to handle Json api request in symfony? for example I have api of customers that allowed me to add new customer, edit and delete, and read as well

my question is how to develope it in symfony, as a bundle? like i have a database? with entity class? if you have any tutorial it will be great

Upvotes: 0

Views: 1291

Answers (1)

Renato Mefi
Renato Mefi

Reputation: 2171

As a Client:

You can use Guzzle to make HTTP calls for you and then convert the json responses using native json_decode. Other option is to use a Rest client, you will find many of them on packagist, here is one: https://packagist.org/packages/Mashape/unirest-php

As a Server:

FOSRestBundle, its gonna provide you with many features that you'll need. here is a tutorial: http://williamdurand.fr/2012/08/02/rest-apis-with-symfony2-the-right-way/

Of course you should check for more sources as well, I have a project of my own which uses it and you can check some code: https://github.com/renatomefidf/sammui

You can also check the LiipHelloBundle for other multiple usages and examples: https://github.com/liip/LiipHelloBundle

Good luck!

Upvotes: 1

Related Questions