Search code examples
phpredispredis

Is there a Predis documentation?


I was using phpredis and now I am also trying predis for my php applications, but I couldn't find a good documentation for the second one. There is a "How to use" in github, but I find it quite short. I checked the examples though and I noticed that they are using the Redis commands in "lower case" characters. I tried a few and it works, but I don't want to try them all to see if this is true...


Solution

  • I'm the author of Predis and I must admit that the library is still lacking a bit in terms of documentation but unfortunately I can't find the right amount of free time to prepare a comprehensive set of docs for the wiki. I'm always looking forward to some contributions :-)

    Just to answer your question, in recent versions of Predis (>= v0.7.0) methods that map to Redis commands are case insensitive which is also the standard behavior of PHP for method names. For example you can call SET using $client->set('foo', 'bar') or $client->SET('foo', 'bar') or even $client->sEt('foo', 'bar'). Older versions of the library (v0.5.x, v0.6.x) on the other hand used a case sensitive approach for Redis commands (lowercase only) due to how their names were treated inside of the __call() metamethod used by Predis.

    See the paragraph How Predis implements abstraction of Redis commands? in this FAQ for further details about how Redis commands are implemented in Predis.