Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have been going round in circles with this question for days - which is the best PHP framework to use to create a RESTful Web service?

I've trawled the web for info and have come across three main factors that are important:

  • must have REST architecture built into the framework
  • must be a stable application
  • must be full featured

It may be that what I want does not exists, but I wanted to check with the community to see of I had missed something.

Currently the three contenders are:

CodeIgniter

Is a very stable framework with a large community and plenty of features and 'extensions'. Issue is that it's not RESTful. I have found a RESTful controller but there are a few things that I don't like about it. Mainly that it does not seem to correctly use the HTTP methods as per the RESTful architecture definition. I think this stems from restrictions in the CodeIgniter core though.

Yii

Again, seems like a large community and is stable with plenty of features, but not RESTful.

Laravel

A framework that is RESTful straight out of the box, and it has a good amount of features. The issue is that this is a relatively new framework so lacks stability.

Other frameworks I've considered:

Zend - from what I've read, avoid unless writing Enterprise software.

Recess - RESTful, but seems very inactive and under used.

UPDATE:

In the end I went for Laravel. Can't recommend it enough! I had a RESTful API up and running in a week and also a simple web client. Amazing framework.

share|improve this question

closed as off-topic by gnat, GlenH7, MichaelT, Kilian Foth, Bart van Ingen Schenau Aug 12 at 20:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, MichaelT, Kilian Foth, Bart van Ingen Schenau
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Though new, Laravel is very stable. I think that component removed alone will answer your question. –  Jacob Krustchinsky Jan 9 '13 at 21:26
    
Checkout this too slimframework.com –  Nelson Jun 11 '13 at 18:06
    
Another good PHP REST framework: luracast.com/products/restler –  shasi Feb 20 at 9:30

1 Answer 1

up vote 11 down vote accepted

Zend Framework is the obvious choice, it's the more well designed, mature and stable of the frameworks you list, and perfectly suitable for RESTful applications. That said and although I've build numerous apps with it and not just "Enterprise" applications, it's notoriously hard to get the hang of and it might just not be your cup of tea. There was a significant effort to simplify it recently, but had I not been an early adopter I'd probably stay far away from it.

CodeIgniter, a framework I've used extensively, isn't really a good choice. As you've already noticed it doesn't offer a RESTful architecture out of the box, and you are quite right in assuming that the design of the core makes any custom RESTful design a bit tedious (the lack of a HTTP Request class comes to mind). It's not impossible, far from it, but CodeIgniter's main attraction, its ease of use, becomes a lot less attractive when you have to write tons of custom code to do relatively simple things that most other frameworks support out of the box.

Which brings us to Laravel, the newest addition to the endless list of PHP frameworks. I must admit I haven't used it extensively, but from what I've seen so far stability is not an issue. It's a bit idiomatic, but it does provide REST out of the box and Eloquent, its ORM, is awesome. I went with Laravel from my latest application, that has some RESTful components, moving on from my usual Zend Framework + Doctrine combo, but this is my first non throwaway application with the framework and I'm still not 100% comfortable with it.

If you feel Zend Framework is too much for you, Laravel certainly seems like a worthy contender. If you don't want to invest in a relatively new project then there's another option that you missed in your research, Symfony. It sits somewhere between Zend Framework and CodeIgniter when it comes to learning curve, and it's as stable as it gets. The FOSRestBundle offers a simple but complete REST API basis for Symfony, and it might just be exactly what you are looking for.

At the end of the day, it's completely up to you and it's not a decision you can take lightly. Its framework imposes architectural choices that you'll have to live with for as long as you are using it, and for comparably mature frameworks more often than not it boils down to personal preference.

Good luck ;)

share|improve this answer
    
Thanks for the detailed response. I guess I need to look at the primary requirement here, which is RESTful. I may give Laravel a go and see how far I get. –  Gaz_Edge Jan 9 '13 at 23:12
    
@Gaz_Edge When I'm evaluating a framework, I usually do a mini project during the weekend to get a general feeling of it. Laravel is a good option, but if you have the time you should also give Symfony a chance. –  Yannis Rizos Jan 9 '13 at 23:25
1  
wow, -2 for your answer! No sure why. Maybe the people who down voted can provide a better answer? –  Gaz_Edge Jan 10 '13 at 9:45
    
I would like to hear from the down-voters too!! –  Songo Jan 10 '13 at 12:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.