12

I am trying to create a API based service using Symfony2 which is the main framework our company tends to work on. I am told to research the best way to create a web service, i.e: REST, SOAP, etc. I am not a very experienced programmer. I am just trying to research the subject matter.

What we basically need is a system that would provide and API to make other apps on any platform or device. For example: I can use the Twitter API to post/fetch tweets. In the same way we are trying to create a E-comm product that would help other users to build sites and apps above the platform regardless of the programming language, device or OS.

We are trying to convert our product into an API based service from a pure "MVC application".

hakre
  • 193,403
  • 52
  • 435
  • 836
Kunwar Siddharth Singh
  • 1,676
  • 6
  • 33
  • 66
  • 5
    https://github.com/FriendsOfSymfony/FOSRestBundle this bundle should accomplish what you ask – Phill Pafford Jun 08 '12 at 14:39
  • 1
    No matter which route you choose, have a look at http://mattgemmell.com/2012/05/24/api-design/ when you actually design the API - I've learned a lot from it about 'proper' API design. If you choice is just between REST and SOAP, then I would personally go for REST - but perhaps read this question and see if that makes it more clear for you: http://stackoverflow.com/questions/2285725/restful-vs-other-web-services – Jeppe Mariager-Lam Jun 09 '12 at 09:04
  • I think you should make your question more specific. It remains largely undefined what MVC means in the PHP world, so that is not much of an information. If you have concrete refactoring questions, you should add some code so it's more clear. – hakre Jun 09 '12 at 12:43

3 Answers3

13

Check the this article REST APIs with Symfony2: The Right Way by William Durand about Designing a REST API.

numediaweb
  • 16,362
  • 12
  • 74
  • 110
HVKotak
  • 258
  • 5
  • 12
2

I think the best repo you could look at is at:

https://github.com/lsmith77/symfony-rest-edition

this is a tutorial

http://welcometothebundle.com/symfony2-rest-api-the-best-2013-way/

liuggio
  • 384
  • 3
  • 3
0

I believe the answers given above are not that introductory to the world of FOSRestBundle so I'd recommend this detailed getting started tutorial on how to properly setup FOSRestBundle with easy to understand examples on controllers, form processing and so on.

Sebastian
  • 250
  • 1
  • 13