20

I want to try playing with CouchDB for a new project I'm writing (as a hobby, not part of my job). I'm well versed in PHP, but I haven't programmed with CouchDB at all, and also I have little experience with non-SQL databases.

From looking at CouchDB's "Getting Started with PHP" document they recommend using a third-party library or writing your own client using their RESTful HTTP API. I think I'd rather not mess with writing protocol implementations myself at this point, but what is your experience with writing PHP to work with CouchDB?

I haven't tested any of the alternatives yet, but I looked at:

  • PHPillow : I'm interested in the way they implement ORM. I wasn't planning to do ORM, but my problem domain probably map well to that method.
  • PHP Object Freezer: seems like a poor man's ORM - I can use it to implement an actual ORM, or just as an easy store/retrieve document API but it seems too primitive.
  • PHP-on-Couch : Also a bit simple, but they have an interesting API for views and from the documentation it looks usable enough.
  • PHP CouchDB Extension : From the listed options this looks like it has the best chance of making it into the PHP mainline itself, and also has the most complete API.

Any opinion one wish to share on each library is welcome.

Guss
  • 30,470
  • 17
  • 104
  • 128

3 Answers3

15

For what it's worth, I had many of the same problems. I ended up using the "advanced" example on the CouchDB wiki for a lot of my first projects, as I found it was better than a lot of the libraries you listed and felt more natural, but got tired of some bugs and lack of features.

So I wrote my own: Sag. Version 0.1.0 is going to be released this week, but the latest code in the repository is stable - I'm using it on a few projects right now. Not that I'm biased or anything. :-)

Cheers.

Sam Bisbee
  • 4,461
  • 20
  • 25
  • 3
    Your library lacks documentation and has one HUGE problem. It does not support error reporting strict. I really like your library and i planned to use it but strict mode is very important. – Szymon Wygnański Feb 24 '12 at 10:22
  • Thanks for the comment Szymon. Here's the documentation from saggingcouch.com: http://www.saggingcouch.com/phpdocs/ Also, I don't support strict mode because I don't see the purpose of it, and find that it actually just hinders the language. Sorry to hear you won't be using Sag for that reason. – Sam Bisbee Feb 27 '12 at 18:56
  • As said by Szymon it's a big problem. Anyway I'm porting one library from Node.js https://github.com/dscape/nano to PHP https://github.com/alrik11es/nano-php I need it for a bunch of new projects so I will be pretty active. Made just with cURL. – Alrik Nov 19 '12 at 13:53
  • FWIW, Sag has a JS compatible version that works both in Node.js and the browser. – Sam Bisbee Dec 30 '12 at 21:49
2

Try PHPillow, its the best out there at the moment.

Aaron McAdam
  • 706
  • 2
  • 7
  • 20
0

In this time is not any fine php library for couch. I was working with phppillow and it is, well, absolutely without relevant documentation:(

podolinek
  • 166
  • 2
  • 12